From 8fcff2241f84d78be1facbad32d4a7fb8202451f Mon Sep 17 00:00:00 2001 From: Filip Hazubski Date: Tue, 14 Jan 2020 14:32:11 +0100 Subject: [PATCH] Add ClDevice Decouple cl_device_id from Device class. Related-To: NEO-3938 Change-Id: I68543a753aea562f3b47ba0d23a059ff3cffa906 Signed-off-by: Filip Hazubski --- .../compiler_cache_tests.cpp | 10 +- .../fixtures/preemption_fixture.cpp | 4 +- core/unit_tests/fixtures/preemption_fixture.h | 4 +- .../gen11/test_preemption_gen11.cpp | 18 +- .../gen12lp/test_preemption_gen12lp.inl | 12 +- core/unit_tests/gen8/test_preemption_gen8.cpp | 26 +-- core/unit_tests/gen9/test_preemption_gen9.cpp | 36 ++-- .../preemption/preemption_tests.cpp | 56 +++--- runtime/api/api.cpp | 51 ++--- runtime/built_ins/built_ins.cpp | 5 +- runtime/command_queue/command_queue.cpp | 12 +- runtime/command_queue/command_queue.h | 11 +- runtime/command_queue/command_queue_hw.h | 4 +- runtime/command_queue/enqueue_common.h | 10 +- runtime/context/context.cpp | 6 +- runtime/context/context.h | 10 +- runtime/device/device.cpp | 102 ++++++++-- runtime/device/device.h | 80 ++++++-- runtime/device/device_caps.cpp | 9 +- runtime/device/device_info.cpp | 71 ++++--- runtime/device/device_vector.h | 17 +- runtime/device/root_device.cpp | 31 +-- runtime/device/root_device.h | 8 +- runtime/device/sub_device.cpp | 17 +- runtime/device/sub_device.h | 7 +- runtime/device_queue/device_queue.cpp | 10 +- runtime/device_queue/device_queue.h | 13 +- runtime/device_queue/device_queue_hw.h | 6 +- runtime/helpers/built_ins_helper.cpp | 6 +- runtime/helpers/built_ins_helper.h | 5 +- runtime/helpers/queue_helpers.cpp | 4 +- runtime/helpers/queue_helpers.h | 7 +- runtime/helpers/validators.cpp | 4 +- runtime/kernel/kernel.cpp | 4 +- runtime/kernel/kernel.h | 6 +- runtime/mem_obj/buffer.cpp | 4 +- runtime/mem_obj/buffer.h | 8 +- runtime/mem_obj/image.cpp | 17 +- .../linux/device_factory_linux.cpp | 2 +- runtime/os_interface/windows/api_win.cpp | 8 +- .../windows/device_factory_win.cpp | 5 +- runtime/platform/platform.cpp | 56 ++++-- runtime/platform/platform.h | 9 +- runtime/program/build.cpp | 9 +- runtime/program/compile.cpp | 4 +- runtime/program/create.cpp | 3 +- runtime/program/create.inl | 15 +- runtime/program/get_info.cpp | 6 +- runtime/program/link.cpp | 6 +- runtime/program/printf_handler.cpp | 6 +- runtime/program/printf_handler.h | 9 +- runtime/program/process_gen_binary.cpp | 2 +- runtime/program/program.cpp | 13 +- runtime/program/program.h | 28 ++- runtime/scheduler/scheduler_kernel.h | 4 +- runtime/sharings/gl/cl_gl_api.cpp | 2 +- runtime/sharings/va/cl_va_api.cpp | 2 +- .../accelerators/media_image_arg_tests.cpp | 6 +- .../api/cl_add_comment_to_aub_tests.inl | 4 +- unit_tests/api/cl_api_tests.cpp | 17 +- unit_tests/api/cl_api_tests.h | 6 +- .../api/cl_create_command_queue_tests.inl | 8 +- ...te_command_queue_with_properties_tests.cpp | 4 +- unit_tests/api/cl_create_image_tests.cpp | 6 +- ...eate_perf_counters_command_queue_tests.inl | 28 +-- unit_tests/api/cl_create_pipe_tests.inl | 4 +- ...te_program_with_built_in_kernels_tests.cpp | 22 +-- .../api/cl_create_sub_devices_tests.inl | 6 +- .../api/cl_get_device_and_host_timer.inl | 10 +- unit_tests/api/cl_get_device_ids_tests.inl | 8 +- unit_tests/api/cl_get_device_info_tests.inl | 2 +- .../api/cl_get_event_profiling_info_tests.inl | 6 +- ...cl_get_kernel_sub_group_info_khr_tests.inl | 24 +-- .../cl_get_kernel_sub_group_info_tests.inl | 36 ++-- .../cl_get_kernel_work_group_info_tests.inl | 8 +- unit_tests/api/cl_get_platform_info_tests.inl | 4 +- .../cl_get_supported_image_formats_tests.inl | 8 +- ...cl_mem_locally_uncached_resource_tests.cpp | 12 +- .../api/cl_release_command_queue_tests.inl | 6 +- .../cl_retain_release_command_queue_tests.inl | 4 +- ...set_default_device_command_queue_tests.inl | 4 +- .../cl_set_kernel_arg_svm_pointer_tests.inl | 4 +- .../api/cl_set_kernel_exec_info_tests.inl | 2 +- unit_tests/api/cl_svm_alloc_tests.inl | 9 +- .../gl/cl_get_gl_context_info_khr_tests.cpp | 4 +- .../enqueue_copy_buffer_aub_tests.cpp | 4 +- .../enqueue_copy_buffer_rect_aub_tests.cpp | 4 +- .../enqueue_copy_image_aub_tests.cpp | 4 +- .../enqueue_fill_buffer_aub_tests.cpp | 6 +- .../enqueue_fill_image_aub_tests.cpp | 4 +- .../enqueue_map_buffer_aub_tests.cpp | 4 +- .../enqueue_map_image_aub_tests.cpp | 4 +- .../enqueue_read_buffer_aub_tests.cpp | 8 +- .../enqueue_read_buffer_rect_aub_tests.cpp | 6 +- .../enqueue_read_image_aub_tests.cpp | 4 +- .../enqueue_read_write_image_aub_fixture.h | 6 +- ...enqueue_verify_memory_buffer_aub_tests.cpp | 4 +- ...nqueue_with_timestamp_packet_aub_tests.cpp | 6 +- .../enqueue_write_buffer_aub_tests.cpp | 6 +- .../enqueue_write_buffer_rect_aub_tests.cpp | 6 +- .../enqueue_write_image_aub_tests.cpp | 4 +- .../aub_command_stream_tests.cpp | 2 +- unit_tests/aub_tests/fixtures/aub_fixture.h | 6 +- .../fixtures/aub_parent_kernel_fixture.h | 6 +- .../aub_tests/fixtures/fixture_tests.cpp | 4 +- .../aub_tests/fixtures/run_kernel_fixture.h | 4 +- .../aub_tests/fixtures/simple_arg_fixture.h | 8 +- .../enqueue_parent_kernel_tests_gen11.cpp | 4 +- .../aub_batch_buffer_tests_gen12lp.cpp | 4 +- .../enqueue_parent_kernel_tests_gen12lp.cpp | 4 +- .../enqueue_parent_kernel_tests_gen8.cpp | 4 +- .../enqueue_parent_kernel_tests_gen9.cpp | 4 +- .../run_kernel_aub_tests_skl.cpp | 8 +- unit_tests/built_ins/built_in_tests.cpp | 20 +- .../command_queue/blit_enqueue_tests.cpp | 9 +- .../command_queue/command_enqueue_fixture.h | 8 +- .../command_queue/command_queue_fixture.cpp | 14 +- .../command_queue/command_queue_fixture.h | 18 +- .../command_queue/command_queue_hw_tests.cpp | 60 +++--- .../command_queue/command_queue_tests.cpp | 99 +++++----- .../command_queue/dispatch_walker_tests.cpp | 84 ++++---- .../enqueue_command_without_kernel_tests.cpp | 12 +- .../enqueue_copy_buffer_rect_tests.cpp | 6 +- .../enqueue_copy_buffer_tests.cpp | 6 +- .../enqueue_copy_buffer_to_image_fixture.h | 10 +- .../enqueue_copy_buffer_to_image_tests.cpp | 6 +- .../enqueue_copy_image_fixture.h | 6 +- .../enqueue_copy_image_to_buffer_fixture.h | 10 +- .../enqueue_copy_image_to_buffer_tests.cpp | 6 +- .../enqueue_debug_kernel_tests.cpp | 10 +- .../enqueue_fill_buffer_tests.cpp | 4 +- .../enqueue_fill_image_fixture.h | 4 +- .../command_queue/enqueue_handler_tests.cpp | 82 ++++---- .../command_queue/enqueue_kernel_1_tests.cpp | 114 +++++------ .../command_queue/enqueue_kernel_2_tests.cpp | 44 ++--- .../command_queue/enqueue_kernel_mt_tests.cpp | 4 +- .../enqueue_kernel_two_ioq_tests.cpp | 4 +- .../enqueue_kernel_two_ooq_tests.cpp | 4 +- .../enqueue_map_buffer_tests.cpp | 10 +- .../command_queue/enqueue_map_image_tests.cpp | 6 +- .../command_queue/enqueue_marker_tests.cpp | 4 +- .../enqueue_migrate_mem_objects_tests.cpp | 4 +- .../enqueue_read_buffer_event_tests.cpp | 6 +- .../enqueue_read_buffer_rect_fixture.h | 4 +- .../enqueue_read_buffer_rect_tests.cpp | 8 +- .../enqueue_read_buffer_tests.cpp | 20 +- .../enqueue_read_image_fixture.h | 4 +- .../enqueue_read_image_tests.cpp | 8 +- .../enqueue_svm_mem_copy_tests.cpp | 8 +- .../enqueue_svm_mem_fill_tests.cpp | 8 +- .../command_queue/enqueue_svm_tests.cpp | 56 +++--- .../command_queue/enqueue_thread_tests.cpp | 14 +- .../enqueue_unmap_memobject_tests.cpp | 6 +- .../enqueue_write_buffer_event_tests.cpp | 6 +- .../enqueue_write_buffer_rect_fixture.h | 4 +- .../enqueue_write_buffer_rect_tests.cpp | 10 +- .../enqueue_write_buffer_tests.cpp | 16 +- .../enqueue_write_image_fixture.h | 4 +- .../enqueue_write_image_tests.cpp | 2 +- unit_tests/command_queue/finish_tests.cpp | 8 +- unit_tests/command_queue/flush_tests.cpp | 4 +- .../get_command_queue_info_tests.cpp | 8 +- .../get_size_required_buffer_tests.cpp | 6 +- .../get_size_required_image_tests.cpp | 6 +- .../command_queue/local_work_size_tests.cpp | 2 +- .../multiple_map_buffer_tests.cpp | 8 +- .../multiple_map_image_tests.cpp | 6 +- unit_tests/command_queue/oom_buffer_tests.cpp | 24 +-- unit_tests/command_queue/oom_image_tests.cpp | 14 +- unit_tests/command_queue/oom_tests.cpp | 6 +- .../read_write_buffer_cpu_copy.cpp | 6 +- .../sync_buffer_handler_tests.cpp | 24 +-- .../command_queue/zero_size_enqueue_tests.cpp | 76 +++---- .../aub_command_stream_receiver_1_tests.cpp | 22 +-- .../command_stream/aub_subcapture_tests.cpp | 24 +-- ...and_stream_receiver_flush_task_1_tests.cpp | 18 +- ...and_stream_receiver_flush_task_2_tests.cpp | 62 +++--- ...and_stream_receiver_flush_task_3_tests.cpp | 62 +++--- ...stream_receiver_flush_task_gmock_tests.cpp | 14 +- .../command_stream_receiver_hw_tests.cpp | 6 +- .../command_stream_receiver_hw_tests.inl | 14 +- .../submissions_aggregator_tests.cpp | 6 +- .../tbx_command_stream_tests.cpp | 10 +- .../context/context_multi_device_tests.cpp | 32 +-- unit_tests/context/context_negative_tests.cpp | 12 +- unit_tests/context/context_tests.cpp | 66 +++---- .../driver_diagnostics_enqueue_tests.cpp | 2 +- .../context/driver_diagnostics_tests.cpp | 82 ++++---- unit_tests/context/driver_diagnostics_tests.h | 14 +- .../get_supported_image_formats_tests.cpp | 36 ++-- unit_tests/context/gl/context_gl_tests.cpp | 20 +- .../d3d_sharing/cl_dx_sharing_tests.cpp | 4 +- unit_tests/d3d_sharing/d3d9_tests.cpp | 10 +- unit_tests/d3d_sharing/d3d_tests_part2.cpp | 10 +- unit_tests/device/device_tests.cpp | 24 ++- .../device/get_device_info_size_tests.cpp | 12 +- unit_tests/device/get_device_info_tests.cpp | 46 ++--- unit_tests/device/sub_device_tests.cpp | 48 +++-- .../device_queue/device_queue_hw_tests.cpp | 28 +-- .../device_queue/device_queue_tests.cpp | 4 +- unit_tests/event/event_builder_tests.cpp | 8 +- unit_tests/event/event_callbacks_tests.cpp | 4 +- unit_tests/event/event_fixture.h | 6 +- unit_tests/event/event_tests.cpp | 74 +++---- .../execution_environment_tests.cpp | 2 +- .../enqueue_execution_model_kernel_tests.cpp | 6 +- .../scheduler_dispatch_tests.cpp | 4 +- .../submit_blocked_parent_kernel_tests.cpp | 4 +- unit_tests/fixtures/buffer_enqueue_fixture.h | 6 +- unit_tests/fixtures/context_fixture.cpp | 4 +- unit_tests/fixtures/d3d_test_fixture.h | 4 +- unit_tests/fixtures/device_fixture.cpp | 7 +- unit_tests/fixtures/device_fixture.h | 3 +- .../fixtures/device_host_queue_fixture.h | 6 +- unit_tests/fixtures/device_info_fixture.h | 4 +- .../device_instrumentation_fixture.cpp | 5 +- .../fixtures/device_instrumentation_fixture.h | 7 +- unit_tests/fixtures/dispatch_flags_fixture.h | 4 +- unit_tests/fixtures/enqueue_handler_fixture.h | 4 +- unit_tests/fixtures/execution_model_fixture.h | 16 +- .../fixtures/execution_model_kernel_fixture.h | 9 +- unit_tests/fixtures/hello_world_fixture.h | 10 +- .../fixtures/hello_world_kernel_fixture.h | 6 +- unit_tests/fixtures/kernel_arg_fixture.cpp | 6 +- .../fixtures/memory_allocator_fixture.h | 3 +- .../fixtures/multi_root_device_fixture.h | 6 +- unit_tests/fixtures/platform_fixture.cpp | 4 +- unit_tests/fixtures/scenario_test_fixture.h | 6 +- .../fixtures/simple_arg_kernel_fixture.h | 12 +- unit_tests/gen11/enqueue_kernel_gen11.cpp | 10 +- unit_tests/gen11/kernel_tests_gen11.cpp | 4 +- ...mmand_stream_receiver_hw_tests_gen12lp.inl | 6 +- .../gen12lp/device_queue_tests_gen12lp.cpp | 10 +- ...hardware_commands_helper_tests_gen12lp.inl | 4 +- .../gen12lp/hw_helper_tests_gen12lp.inl | 4 +- unit_tests/gen12lp/kernel_tests_gen12lp.inl | 4 +- .../gen12lp/profiling_tests_gen12lp.inl | 6 +- unit_tests/gen8/kernel_tests_gen8.cpp | 4 +- unit_tests/gen9/enqueue_kernel_gen9.cpp | 10 +- unit_tests/gen9/kernel_tests_gen9.cpp | 4 +- unit_tests/global_environment.cpp | 14 +- unit_tests/gtpin/gtpin_tests.cpp | 6 +- unit_tests/helpers/built_ins_helper.cpp | 4 +- .../helpers/dispatch_info_builder_tests.cpp | 6 +- unit_tests/helpers/dispatch_info_tests.cpp | 6 +- .../hardware_commands_helper_tests.cpp | 56 +++--- unit_tests/helpers/kmd_notify_tests.cpp | 4 +- unit_tests/helpers/task_information_tests.cpp | 14 +- unit_tests/helpers/timestamp_packet_tests.cpp | 42 ++-- unit_tests/kernel/clone_kernel_tests.cpp | 10 +- unit_tests/kernel/debug_kernel_tests.cpp | 18 +- .../kernel/kernel_accelerator_arg_tests.cpp | 6 +- .../kernel/kernel_arg_buffer_fixture.cpp | 6 +- .../kernel/kernel_arg_dev_queue_tests.cpp | 4 +- unit_tests/kernel/kernel_arg_info_tests.cpp | 4 +- unit_tests/kernel/kernel_arg_pipe_tests.cpp | 6 +- unit_tests/kernel/kernel_arg_svm_tests.cpp | 10 +- .../kernel_cache_flush_requirements_tests.cpp | 4 +- .../kernel/kernel_immediate_arg_tests.cpp | 4 +- unit_tests/kernel/kernel_is_patched_tests.cpp | 6 +- .../kernel_reflection_surface_tests.cpp | 18 +- unit_tests/kernel/kernel_slm_arg_tests.cpp | 4 +- unit_tests/kernel/kernel_slm_tests.cpp | 8 +- unit_tests/kernel/kernel_tests.cpp | 186 +++++++++--------- unit_tests/kernel/parent_kernel_tests.cpp | 17 +- .../kernel/substitute_kernel_heap_tests.cpp | 8 +- unit_tests/mem_obj/buffer_set_arg_tests.cpp | 6 +- unit_tests/mem_obj/buffer_tests.cpp | 51 ++--- .../mem_obj/destructor_callback_tests.cpp | 4 +- .../mem_obj/get_mem_object_info_tests.cpp | 4 +- unit_tests/mem_obj/image1d_tests.cpp | 4 +- .../mem_obj/image2d_from_buffer_tests.cpp | 2 +- unit_tests/mem_obj/image2d_tests.cpp | 4 +- unit_tests/mem_obj/image3d_tests.cpp | 4 +- unit_tests/mem_obj/image_array_size_tests.cpp | 4 +- .../mem_obj/image_compression_fixture.h | 6 +- .../image_release_mapped_ptr_tests.cpp | 8 +- unit_tests/mem_obj/image_set_arg_tests.cpp | 8 +- unit_tests/mem_obj/image_tests.cpp | 9 +- unit_tests/mem_obj/image_tiled_tests.cpp | 2 +- unit_tests/mem_obj/image_transfer_tests.cpp | 4 +- unit_tests/mem_obj/image_validate_tests.cpp | 12 +- .../mem_obj/mem_obj_destruction_tests.cpp | 4 +- unit_tests/mem_obj/mem_obj_tests.cpp | 4 +- unit_tests/mem_obj/nv12_image_tests.cpp | 2 +- .../memory_manager/memory_manager_tests.cpp | 16 +- unit_tests/mocks/mock_buffer.h | 4 +- unit_tests/mocks/mock_command_queue.h | 4 +- unit_tests/mocks/mock_context.cpp | 4 +- unit_tests/mocks/mock_context.h | 6 +- unit_tests/mocks/mock_device.cpp | 25 +++ unit_tests/mocks/mock_device.h | 54 ++++- unit_tests/mocks/mock_device_queue.h | 4 +- unit_tests/mocks/mock_kernel.h | 20 +- unit_tests/mocks/mock_program.cpp | 5 +- unit_tests/mocks/mock_program.h | 6 +- .../device_queue/device_queue_mt_tests.cpp | 4 +- .../os_interface/linux/device_os_tests.cpp | 23 ++- .../linux/drm_memory_manager_tests.h | 4 +- ...te_command_queue_with_properties_tests.cpp | 12 +- .../linux/mock_performance_counters_linux.cpp | 6 +- .../mock_performance_counters.cpp | 4 +- .../os_interface/mock_performance_counters.h | 4 +- .../performance_counters_tests.cpp | 4 +- .../os_interface/windows/device_os_tests.cpp | 26 ++- .../windows/mock_performance_counters_win.cpp | 6 +- .../windows/wddm_memory_manager_tests.cpp | 3 +- unit_tests/platform/platform_tests.cpp | 52 ++--- unit_tests/profiling/profiling_tests.cpp | 28 +-- unit_tests/program/printf_handler_tests.cpp | 16 +- unit_tests/program/printf_helper_tests.cpp | 6 +- unit_tests/program/program_data_tests.cpp | 8 +- unit_tests/program/program_from_binary.h | 6 +- unit_tests/program/program_nonuniform.cpp | 10 +- unit_tests/program/program_tests.cpp | 132 ++++++------- .../program_with_block_kernels_tests.cpp | 4 +- .../program_with_kernel_debug_tests.cpp | 4 +- unit_tests/program/program_with_source.h | 4 +- unit_tests/sampler/sampler_set_arg_tests.cpp | 12 +- ...blocked_enqueue_barrier_scenario_tests.cpp | 4 +- ...d_write_buffer_scenarios_windows_tests.cpp | 6 +- .../scheduler/scheduler_kernel_tests.cpp | 44 ++--- unit_tests/scheduler/scheduler_source_tests.h | 6 +- .../sharings/gl/gl_arb_sync_event_tests.cpp | 4 +- unit_tests/sharings/gl/gl_sharing_tests.cpp | 2 +- unit_tests/sharings/gl/gl_texture_tests.cpp | 4 +- unit_tests/sharings/sharing_factory_tests.cpp | 8 +- .../unified/unified_sharing_fixtures.h | 12 +- .../unified/unified_sharing_tests.cpp | 8 +- unit_tests/sharings/va/context_va_tests.cpp | 6 +- unit_tests/sharings/va/va_sharing_tests.cpp | 4 +- .../source_level_debugger_csr_tests.cpp | 20 +- unit_tests/utilities/file_logger_tests.cpp | 20 +- 333 files changed, 2482 insertions(+), 2149 deletions(-) diff --git a/core/unit_tests/compiler_interface/compiler_cache_tests.cpp b/core/unit_tests/compiler_interface/compiler_cache_tests.cpp index 7e2314b9f5..06885487f6 100644 --- a/core/unit_tests/compiler_interface/compiler_cache_tests.cpp +++ b/core/unit_tests/compiler_interface/compiler_cache_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -312,7 +312,7 @@ TEST(CompilerInterfaceCachedTests, wasCached) { } TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsNotCalled) { - MockDevice device; + MockClDevice device{new MockDevice}; MockContext context(&device, true); MockProgram program(*device.getExecutionEnvironment(), &context, false); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -337,7 +337,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhe auto compilerInterface = std::unique_ptr(CompilerInterface::createInstance(std::move(cache), true)); TranslationOutput translationOutput; inputArgs.allowCaching = true; - auto retVal = compilerInterface->build(device, inputArgs, translationOutput); + auto retVal = compilerInterface->build(device.getDevice(), inputArgs, translationOutput); EXPECT_EQ(TranslationOutput::ErrorCode::Success, retVal); gEnvironment->fclPopDebugVars(); @@ -345,7 +345,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhe } TEST(CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsCalled) { - MockDevice device; + MockClDevice device{new MockDevice}; MockContext context(&device, true); MockProgram program(*device.getExecutionEnvironment(), &context, false); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -363,7 +363,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCo auto compilerInterface = std::unique_ptr(CompilerInterface::createInstance(std::move(cache), true)); TranslationOutput translationOutput; inputArgs.allowCaching = true; - auto retVal = compilerInterface->build(device, inputArgs, translationOutput); + auto retVal = compilerInterface->build(device.getDevice(), inputArgs, translationOutput); EXPECT_EQ(TranslationOutput::ErrorCode::BuildFailure, retVal); gEnvironment->fclPopDebugVars(); diff --git a/core/unit_tests/fixtures/preemption_fixture.cpp b/core/unit_tests/fixtures/preemption_fixture.cpp index 6fc73972e6..7492233a0d 100644 --- a/core/unit_tests/fixtures/preemption_fixture.cpp +++ b/core/unit_tests/fixtures/preemption_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -35,7 +35,7 @@ void DevicePreemptionTests::SetUp() { } const cl_queue_properties properties[3] = {CL_QUEUE_PROPERTIES, 0, 0}; kernelInfo = std::make_unique(); - device.reset(MockDevice::createWithNewExecutionEnvironment(nullptr)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); context.reset(new MockContext(device.get())); cmdQ.reset(new MockCommandQueue(context.get(), device.get(), properties)); executionEnvironment.reset(new SPatchExecutionEnvironment); diff --git a/core/unit_tests/fixtures/preemption_fixture.h b/core/unit_tests/fixtures/preemption_fixture.h index 03d7796471..84d3b86258 100644 --- a/core/unit_tests/fixtures/preemption_fixture.h +++ b/core/unit_tests/fixtures/preemption_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -49,7 +49,7 @@ class DevicePreemptionTests : public ::testing::Test { std::unique_ptr dispatchInfo; std::unique_ptr kernel; std::unique_ptr cmdQ; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr dbgRestore; std::unique_ptr executionEnvironment; diff --git a/core/unit_tests/gen11/test_preemption_gen11.cpp b/core/unit_tests/gen11/test_preemption_gen11.cpp index e5039d7233..1c5dcef64a 100644 --- a/core/unit_tests/gen11/test_preemption_gen11.cpp +++ b/core/unit_tests/gen11/test_preemption_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,11 +31,11 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails() { GEN11TEST_F(Gen11PreemptionTests, whenMidThreadPreemptionIsNotAvailableThenDoesNotProgramStateSip) { device->setPreemptionMode(PreemptionMode::ThreadGroup); - size_t requiredSize = PreemptionHelper::getRequiredPreambleSize(*device); + size_t requiredSize = PreemptionHelper::getRequiredPreambleSize(device->getDevice()); EXPECT_EQ(0U, requiredSize); LinearStream cmdStream{nullptr, 0}; - PreemptionHelper::getRequiredStateSipCmdSize(*device); + PreemptionHelper::getRequiredStateSipCmdSize(device->getDevice()); EXPECT_EQ(0U, cmdStream.getUsed()); } @@ -45,7 +45,7 @@ GEN11TEST_F(Gen11PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSip device->setPreemptionMode(PreemptionMode::MidThread); executionEnvironment->DisableMidThreadPreemption = 0; - size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize(*device); + size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize(device->getDevice()); size_t expectedPreambleSize = sizeof(STATE_SIP); EXPECT_EQ(expectedPreambleSize, requiredCmdStreamSize); @@ -53,28 +53,28 @@ GEN11TEST_F(Gen11PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSip ASSERT_LE(requiredCmdStreamSize, streamStorage.size()); LinearStream cmdStream{streamStorage.begin(), streamStorage.size()}; - PreemptionHelper::programStateSip(cmdStream, *device); + PreemptionHelper::programStateSip(cmdStream, device->getDevice()); HardwareParse hwParsePreamble; hwParsePreamble.parseCommands(cmdStream); auto stateSipCmd = hwParsePreamble.getCommand(); ASSERT_NE(nullptr, stateSipCmd); - EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, *device).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer()); + EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, device->getDevice()).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer()); } GEN11TEST_F(Gen11PreemptionTests, getRequiredCmdQSize) { size_t expectedSize = 0; - EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize(*device)); + EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize(device->getDevice())); } GEN11TEST_F(Gen11PreemptionTests, applyPreemptionWaCmds) { size_t usedSize = 0; auto &cmdStream = cmdQ->getCS(0); - PreemptionHelper::applyPreemptionWaCmdsBegin(&cmdStream, *device); + PreemptionHelper::applyPreemptionWaCmdsBegin(&cmdStream, device->getDevice()); EXPECT_EQ(usedSize, cmdStream.getUsed()); - PreemptionHelper::applyPreemptionWaCmdsEnd(&cmdStream, *device); + PreemptionHelper::applyPreemptionWaCmdsEnd(&cmdStream, device->getDevice()); EXPECT_EQ(usedSize, cmdStream.getUsed()); } diff --git a/core/unit_tests/gen12lp/test_preemption_gen12lp.inl b/core/unit_tests/gen12lp/test_preemption_gen12lp.inl index 600b84a717..6302cbfac7 100644 --- a/core/unit_tests/gen12lp/test_preemption_gen12lp.inl +++ b/core/unit_tests/gen12lp/test_preemption_gen12lp.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,26 +26,26 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails() { } GEN12LPTEST_F(Gen12LpPreemptionTests, whenProgramStateSipIsCalledThenStateSipCmdIsNotAddedToStream) { - size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize(*device); + size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize(device->getDevice()); EXPECT_EQ(0U, requiredSize); LinearStream cmdStream{nullptr, 0}; - PreemptionHelper::programStateSip(cmdStream, *device); + PreemptionHelper::programStateSip(cmdStream, device->getDevice()); EXPECT_EQ(0U, cmdStream.getUsed()); } GEN12LPTEST_F(Gen12LpPreemptionTests, getRequiredCmdQSize) { size_t expectedSize = 0; - EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize(*device)); + EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize(device->getDevice())); } GEN12LPTEST_F(Gen12LpPreemptionTests, applyPreemptionWaCmds) { size_t usedSize = 0; auto &cmdStream = cmdQ->getCS(0); - PreemptionHelper::applyPreemptionWaCmdsBegin(&cmdStream, *device); + PreemptionHelper::applyPreemptionWaCmdsBegin(&cmdStream, device->getDevice()); EXPECT_EQ(usedSize, cmdStream.getUsed()); - PreemptionHelper::applyPreemptionWaCmdsEnd(&cmdStream, *device); + PreemptionHelper::applyPreemptionWaCmdsEnd(&cmdStream, device->getDevice()); EXPECT_EQ(usedSize, cmdStream.getUsed()); } diff --git a/core/unit_tests/gen8/test_preemption_gen8.cpp b/core/unit_tests/gen8/test_preemption_gen8.cpp index 1dd4a575e1..6a1b8730dc 100644 --- a/core/unit_tests/gen8/test_preemption_gen8.cpp +++ b/core/unit_tests/gen8/test_preemption_gen8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,16 +33,16 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails() { GEN8TEST_F(Gen8PreemptionTests, allowThreadGroupPreemptionReturnsTrue) { PreemptionFlags flags = {}; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags)); } GEN8TEST_F(Gen8PreemptionTests, whenProgramStateSipIsCalledThenNoCmdsAreProgrammed) { - size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize(*device); + size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize(device->getDevice()); EXPECT_EQ(0U, requiredSize); LinearStream cmdStream{nullptr, 0}; - PreemptionHelper::programStateSip(cmdStream, *device); + PreemptionHelper::programStateSip(cmdStream, device->getDevice()); EXPECT_EQ(0U, cmdStream.getUsed()); } @@ -54,7 +54,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreempt size_t off[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); HardwareParse hwParser; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr); @@ -73,7 +73,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); PreemptionFlags flags = {}; MultiDispatchInfo multiDispatch(mockKernel.mockKernel); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch)); @@ -91,7 +91,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); PreemptionFlags flags = {}; PreemptionHelper::setPreemptionLevelFlags(flags, *pDevice, mockKernel.mockKernel); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(pDevice->getPreemptionMode(), flags)); @@ -114,7 +114,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); PreemptionFlags flags = {}; PreemptionHelper::setPreemptionLevelFlags(flags, *pDevice, mockKernel.mockKernel); EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(pDevice->getPreemptionMode(), flags)); @@ -130,7 +130,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeMidBatch) { size_t expectedSize = 0; device->setPreemptionMode(PreemptionMode::MidBatch); - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -138,7 +138,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeThreadGroupNoWa) { size_t expectedSize = 0; device->setPreemptionMode(PreemptionMode::ThreadGroup); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -147,7 +147,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeThreadGroupWa) { size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM); device->setPreemptionMode(PreemptionMode::ThreadGroup); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -155,7 +155,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeMidThreadNoWa) { size_t expectedSize = 0; device->setPreemptionMode(PreemptionMode::MidThread); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -164,7 +164,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeMidThreadWa) { size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM); device->setPreemptionMode(PreemptionMode::MidThread); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } diff --git a/core/unit_tests/gen9/test_preemption_gen9.cpp b/core/unit_tests/gen9/test_preemption_gen9.cpp index cbe618d5a3..98add0b597 100644 --- a/core/unit_tests/gen9/test_preemption_gen9.cpp +++ b/core/unit_tests/gen9/test_preemption_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -49,11 +49,11 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails() { GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsNotAvailableThenDoesNotProgramPreamble) { device->setPreemptionMode(PreemptionMode::ThreadGroup); - size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize(*device); + size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize(device->getDevice()); EXPECT_EQ(0U, requiredSize); LinearStream cmdStream{nullptr, 0}; - PreemptionHelper::programStateSip(cmdStream, *device); + PreemptionHelper::programStateSip(cmdStream, device->getDevice()); EXPECT_EQ(0U, cmdStream.getUsed()); } @@ -67,7 +67,7 @@ GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSipIs uint64_t minCsrAlignment = 2 * 256 * MemoryConstants::kiloByte; MockGraphicsAllocation csrSurface((void *)minCsrAlignment, minCsrSize); - size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize(*device); + size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize(device->getDevice()); size_t expectedPreambleSize = sizeof(STATE_SIP); EXPECT_EQ(expectedPreambleSize, requiredCmdStreamSize); @@ -75,14 +75,14 @@ GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSipIs ASSERT_LE(requiredCmdStreamSize, streamStorage.size()); LinearStream cmdStream{streamStorage.begin(), streamStorage.size()}; - PreemptionHelper::programStateSip(cmdStream, *device); + PreemptionHelper::programStateSip(cmdStream, device->getDevice()); HardwareParse hwParsePreamble; hwParsePreamble.parseCommands(cmdStream); auto stateSipCmd = hwParsePreamble.getCommand(); ASSERT_NE(nullptr, stateSipCmd); - EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, *device).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer()); + EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, device->getDevice()).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer()); } GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreemptionRequestThenDontReprogramThreadGroupNoWa) { @@ -97,7 +97,7 @@ GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithThe size_t off[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); HardwareParse hwParserCsr; HardwareParse hwParserCmdQ; @@ -131,7 +131,7 @@ GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithThe size_t off[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr); hwCsrParser.parseCommands(csr.commandStream); @@ -212,7 +212,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); MultiDispatchInfo multiDispatch(mockKernel.mockKernel); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch)); @@ -230,7 +230,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); MultiDispatchInfo multiDispatch(mockKernel.mockKernel); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch)); @@ -263,7 +263,7 @@ GEN9TEST_F(Gen9MidThreadPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSa size_t off[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr); hwCsrParser.parseCommands(csr.commandStream); @@ -340,7 +340,7 @@ GEN9TEST_F(Gen9MidThreadPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSa size_t off[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr); hwCsrParser.parseCommands(csr.commandStream); @@ -431,7 +431,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); MultiDispatchInfo multiDispatch(mockKernel.mockKernel); EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch)); @@ -446,7 +446,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeMidBatch) { size_t expectedSize = 0; device->setPreemptionMode(PreemptionMode::MidBatch); - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -454,7 +454,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeThreadGroupNoWa) { size_t expectedSize = 0; device->setPreemptionMode(PreemptionMode::ThreadGroup); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -463,7 +463,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeThreadGroupWa) { size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM); device->setPreemptionMode(PreemptionMode::ThreadGroup); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -471,7 +471,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeMidThreadNoWa) { size_t expectedSize = 0; device->setPreemptionMode(PreemptionMode::MidThread); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } @@ -480,7 +480,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeMidThreadWa) { size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM); device->setPreemptionMode(PreemptionMode::MidThread); device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true; - size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); + size_t size = PreemptionHelper::getPreemptionWaCsSize(device->getDevice()); EXPECT_EQ(expectedSize, size); } diff --git a/core/unit_tests/preemption/preemption_tests.cpp b/core/unit_tests/preemption/preemption_tests.cpp index 013bf8be82..d028a9e98c 100644 --- a/core/unit_tests/preemption/preemption_tests.cpp +++ b/core/unit_tests/preemption/preemption_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -45,7 +45,7 @@ class MidThreadPreemptionTests : public DevicePreemptionTests { TEST_F(ThreadGroupPreemptionTests, disallowByKMD) { PreemptionFlags flags = {}; waTable->waDisablePerCtxtPreemptionGranularityControl = 1; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -53,7 +53,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByKMD) { TEST_F(ThreadGroupPreemptionTests, disallowByDevice) { PreemptionFlags flags = {}; device->setPreemptionMode(PreemptionMode::MidThread); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::MidThread, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -62,7 +62,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByReadWriteFencesWA) { PreemptionFlags flags = {}; executionEnvironment->UsesFencesForReadWriteImages = 1u; waTable->waDisableLSQCROPERFforOCL = 1; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -70,7 +70,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByReadWriteFencesWA) { TEST_F(ThreadGroupPreemptionTests, disallowBySchedulerKernel) { PreemptionFlags flags = {}; kernel.reset(new MockKernel(program.get(), *kernelInfo, *device, true)); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -79,7 +79,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByVmeKernel) { PreemptionFlags flags = {}; kernelInfo->isVmeWorkload = true; kernel.reset(new MockKernel(program.get(), *kernelInfo, *device)); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -92,7 +92,7 @@ TEST_F(ThreadGroupPreemptionTests, simpleAllow) { TEST_F(ThreadGroupPreemptionTests, allowDefaultModeForNonKernelRequest) { PreemptionFlags flags = {}; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -100,7 +100,7 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithNoEnvironmentPatchSetWhenLSQCW PreemptionFlags flags = {}; kernelInfo.get()->patchInfo.executionEnvironment = nullptr; waTable->waDisableLSQCROPERFforOCL = 1; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -109,7 +109,7 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithEnvironmentPatchSetWhenLSQCWaI PreemptionFlags flags = {}; executionEnvironment.get()->UsesFencesForReadWriteImages = 0; waTable->waDisableLSQCROPERFforOCL = 1; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -118,7 +118,7 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithEnvironmentPatchSetWhenLSQCWaI PreemptionFlags flags = {}; executionEnvironment.get()->UsesFencesForReadWriteImages = 1; waTable->waDisableLSQCROPERFforOCL = 0; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags)); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -126,27 +126,27 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithEnvironmentPatchSetWhenLSQCWaI TEST_F(ThreadGroupPreemptionTests, allowMidBatch) { PreemptionFlags flags = {}; device->setPreemptionMode(PreemptionMode::MidBatch); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr); EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } TEST_F(ThreadGroupPreemptionTests, disallowWhenAdjustedDisabled) { PreemptionFlags flags = {}; device->setPreemptionMode(PreemptionMode::Disabled); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr); EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } TEST_F(ThreadGroupPreemptionTests, returnDefaultDeviceModeForZeroSizedMdi) { MultiDispatchInfo multiDispatchInfo; - EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo)); + EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo)); } TEST_F(ThreadGroupPreemptionTests, returnDefaultDeviceModeForValidKernelsInMdi) { MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(*dispatchInfo); multiDispatchInfo.push(*dispatchInfo); - EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo)); + EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo)); } TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeForValidKernelsInMdiAndDisabledPremption) { @@ -154,7 +154,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeForValidKernelsInMdi MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(*dispatchInfo); multiDispatchInfo.push(*dispatchInfo); - EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo)); + EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo)); } TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeWhenAtLeastOneInvalidKernelInMdi) { @@ -162,7 +162,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeWhenAtLeastOneInvali DispatchInfo schedulerDispatchInfo(&schedulerKernel, 1, Vec3(1, 1, 1), Vec3(1, 1, 1), Vec3(0, 0, 0)); PreemptionFlags flags = {}; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, &schedulerKernel); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), &schedulerKernel); EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); MultiDispatchInfo multiDispatchInfo; @@ -170,21 +170,21 @@ TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeWhenAtLeastOneInvali multiDispatchInfo.push(schedulerDispatchInfo); multiDispatchInfo.push(*dispatchInfo); - EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo)); + EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo)); } TEST_F(MidThreadPreemptionTests, allowMidThreadPreemption) { PreemptionFlags flags = {}; device->setPreemptionMode(PreemptionMode::MidThread); executionEnvironment->DisableMidThreadPreemption = 0; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags)); } TEST_F(MidThreadPreemptionTests, allowMidThreadPreemptionNullKernel) { PreemptionFlags flags = {}; device->setPreemptionMode(PreemptionMode::MidThread); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr); EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags)); } @@ -194,7 +194,7 @@ TEST_F(MidThreadPreemptionTests, allowMidThreadPreemptionDeviceSupportPreemption device->deviceInfo.vmeAvcSupportsPreemption = true; kernelInfo->isVmeWorkload = true; kernel.reset(new MockKernel(program.get(), *kernelInfo, *device)); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags)); } @@ -202,7 +202,7 @@ TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByDevice) { PreemptionFlags flags = {}; device->setPreemptionMode(PreemptionMode::ThreadGroup); executionEnvironment->DisableMidThreadPreemption = 0; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags)); EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags)); } @@ -211,7 +211,7 @@ TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByKernel) { PreemptionFlags flags = {}; device->setPreemptionMode(PreemptionMode::MidThread); executionEnvironment->DisableMidThreadPreemption = 1; - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_FALSE(PreemptionHelper::allowMidThreadPreemption(flags)); } @@ -221,7 +221,7 @@ TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByVmeKernel) { device->deviceInfo.vmeAvcSupportsPreemption = false; kernelInfo->isVmeWorkload = true; kernel.reset(new MockKernel(program.get(), *kernelInfo, *device)); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); EXPECT_FALSE(PreemptionHelper::allowMidThreadPreemption(flags)); } @@ -229,7 +229,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByDevice) { PreemptionFlags flags = {}; executionEnvironment->DisableMidThreadPreemption = 0; device->setPreemptionMode(PreemptionMode::ThreadGroup); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags); EXPECT_EQ(PreemptionMode::ThreadGroup, outMode); } @@ -238,7 +238,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByKernel) { PreemptionFlags flags = {}; executionEnvironment->DisableMidThreadPreemption = 1; device->setPreemptionMode(PreemptionMode::MidThread); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags); EXPECT_EQ(PreemptionMode::ThreadGroup, outMode); } @@ -249,7 +249,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByVmeKernel) { device->deviceInfo.vmeAvcSupportsPreemption = false; kernel.reset(new MockKernel(program.get(), *kernelInfo, *device)); device->setPreemptionMode(PreemptionMode::MidThread); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags); //VME disables mid thread and thread group when device does not support it EXPECT_EQ(PreemptionMode::MidBatch, outMode); @@ -259,7 +259,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionAllow) { PreemptionFlags flags = {}; executionEnvironment->DisableMidThreadPreemption = 0; device->setPreemptionMode(PreemptionMode::MidThread); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags); EXPECT_EQ(PreemptionMode::MidThread, outMode); } @@ -271,7 +271,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionAllowDeviceSupportsPreemptionOnVm kernel.reset(new MockKernel(program.get(), *kernelInfo, *device)); device->deviceInfo.vmeAvcSupportsPreemption = true; device->setPreemptionMode(PreemptionMode::MidThread); - PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get()); + PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get()); PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags); EXPECT_EQ(PreemptionMode::MidThread, outMode); } diff --git a/runtime/api/api.cpp b/runtime/api/api.cpp index c6526aedc7..f245d39697 100644 --- a/runtime/api/api.cpp +++ b/runtime/api/api.cpp @@ -207,7 +207,7 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform, cl_uint retNum = 0; for (auto rootDeviceIndex = 0u; rootDeviceIndex < numDev; rootDeviceIndex++) { - Device *device = pPlatform->getDevice(rootDeviceIndex); + ClDevice *device = pPlatform->getClDevice(rootDeviceIndex); DEBUG_BREAK_IF(device == nullptr); if (deviceType & device->getDeviceInfo().deviceType) { @@ -243,7 +243,7 @@ cl_int CL_API_CALL clGetDeviceInfo(cl_device_id device, API_ENTER(&retVal); DBG_LOG_INPUTS("clDevice", device, "paramName", paramName, "paramValueSize", paramValueSize, "paramValue", NEO::FileLoggerInstance().infoPointerToString(paramValue, paramValueSize), "paramValueSizeRet", paramValueSizeRet); - Device *pDevice = castToObject(device); + ClDevice *pDevice = castToObject(device); if (pDevice != nullptr) { retVal = pDevice->getDeviceInfo(paramName, paramValueSize, paramValue, paramValueSizeRet); @@ -258,7 +258,7 @@ cl_int CL_API_CALL clCreateSubDevices(cl_device_id inDevice, cl_device_id *outDevices, cl_uint *numDevicesRet) { - Device *pInDevice = castToObject(inDevice); + ClDevice *pInDevice = castToObject(inDevice); if (pInDevice == nullptr) { return CL_INVALID_DEVICE; } @@ -295,9 +295,9 @@ cl_int CL_API_CALL clRetainDevice(cl_device_id device) { cl_int retVal = CL_INVALID_DEVICE; API_ENTER(&retVal); DBG_LOG_INPUTS("device", device); - auto pDevice = castToObject(device); + auto pDevice = castToObject(device); if (pDevice) { - pDevice->retain(); + pDevice->retainApi(); retVal = CL_SUCCESS; } @@ -310,9 +310,9 @@ cl_int CL_API_CALL clReleaseDevice(cl_device_id device) { cl_int retVal = CL_INVALID_DEVICE; API_ENTER(&retVal); DBG_LOG_INPUTS("device", device); - auto pDevice = castToObject(device); + auto pDevice = castToObject(device); if (pDevice) { - pDevice->release(); + pDevice->releaseApi(); retVal = CL_SUCCESS; } @@ -351,7 +351,7 @@ cl_context CL_API_CALL clCreateContext(const cl_context_properties *properties, break; } - DeviceVector allDevs(devices, numDevices); + ClDeviceVector allDevs(devices, numDevices); context = Context::create(properties, allDevs, funcNotify, userData, retVal); if (context != nullptr) { gtpinNotifyContextCreate(context); @@ -397,7 +397,7 @@ cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties *prop retVal = clGetDeviceIDs(nullptr, deviceType, numDevices, supportedDevs.begin(), nullptr); DEBUG_BREAK_IF(retVal != CL_SUCCESS); - DeviceVector allDevs(supportedDevs.begin(), numDevices); + ClDeviceVector allDevs(supportedDevs.begin(), numDevices); pContext = Context::create(properties, allDevs, funcNotify, userData, retVal); if (pContext != nullptr) { gtpinNotifyContextCreate((cl_context)pContext); @@ -488,7 +488,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context, } Context *pContext = nullptr; - Device *pDevice = nullptr; + ClDevice *pDevice = nullptr; retVal = validateObjects( WithCastToInternal(context, &pContext), @@ -999,9 +999,9 @@ cl_int CL_API_CALL clGetSupportedImageFormats(cl_context context, "numImageFormats", numImageFormats); auto pContext = castToObject(context); if (pContext) { - auto pDevice = pContext->getDevice(0); - if (pDevice->getHardwareInfo().capabilityTable.supportsImages) { - retVal = pContext->getSupportedImageFormats(pDevice, flags, imageType, numEntries, + auto pClDevice = pContext->getDevice(0); + if (pClDevice->getHardwareInfo().capabilityTable.supportsImages) { + retVal = pContext->getSupportedImageFormats(&pClDevice->getDevice(), flags, imageType, numEntries, imageFormats, numImageFormats); } else { retVal = CL_INVALID_VALUE; @@ -1346,12 +1346,12 @@ cl_program CL_API_CALL clCreateProgramWithBuiltInKernels(cl_context context, for (cl_uint i = 0; i < numDevices; i++) { auto pContext = castToObject(context); validateObject(pContext); - auto pDev = castToObject(*deviceList); - validateObject(pDev); + auto pDevice = castToObject(*deviceList); + validateObject(pDevice); - program = pDev->getExecutionEnvironment()->getBuiltIns()->createBuiltInProgram( + program = pDevice->getExecutionEnvironment()->getBuiltIns()->createBuiltInProgram( *pContext, - *pDev, + pDevice->getDevice(), kernelNames, retVal); if (program && retVal == CL_SUCCESS) { @@ -3382,12 +3382,13 @@ clCreatePerfCountersCommandQueueINTEL( cl_command_queue commandQueue = nullptr; ErrorCodeHelper err(errcodeRet, CL_SUCCESS); - Device *pDevice = nullptr; + ClDevice *pDevice = nullptr; WithCastToInternal(device, &pDevice); if (pDevice == nullptr) { err.set(CL_INVALID_DEVICE); return commandQueue; } + if (!pDevice->getHardwareInfo().capabilityTable.instrumentationEnabled) { err.set(CL_INVALID_DEVICE); return commandQueue; @@ -3477,7 +3478,7 @@ void *clDeviceMemAllocINTEL( cl_uint alignment, cl_int *errcodeRet) { Context *neoContext = nullptr; - Device *neoDevice = nullptr; + ClDevice *neoDevice = nullptr; ErrorCodeHelper err(errcodeRet, CL_SUCCESS); @@ -3516,7 +3517,7 @@ void *clSharedMemAllocINTEL( cl_uint alignment, cl_int *errcodeRet) { Context *neoContext = nullptr; - Device *neoDevice = nullptr; + ClDevice *neoDevice = nullptr; ErrorCodeHelper err(errcodeRet, CL_SUCCESS); @@ -4593,7 +4594,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte ErrorCodeHelper err(errcodeRet, CL_SUCCESS); Context *pContext = nullptr; - Device *pDevice = nullptr; + ClDevice *pDevice = nullptr; retVal = validateObjects( WithCastToInternal(context, &pContext), @@ -4814,7 +4815,7 @@ cl_int CL_API_CALL clGetDeviceAndHostTimer(cl_device_id device, "deviceTimestamp", deviceTimestamp, "hostTimestamp", hostTimestamp); do { - Device *pDevice = castToObject(device); + ClDevice *pDevice = castToObject(device); if (pDevice == nullptr) { retVal = CL_INVALID_DEVICE; break; @@ -4842,7 +4843,7 @@ cl_int CL_API_CALL clGetHostTimer(cl_device_id device, "hostTimestamp", hostTimestamp); do { - Device *pDevice = castToObject(device); + ClDevice *pDevice = castToObject(device); if (pDevice == nullptr) { retVal = CL_INVALID_DEVICE; break; @@ -5090,7 +5091,7 @@ cl_int CL_API_CALL clAddCommentINTEL(cl_device_id device, const char *comment) { API_ENTER(&retVal); DBG_LOG_INPUTS("device", device, "comment", comment); - Device *pDevice = nullptr; + ClDevice *pDevice = nullptr; retVal = validateObjects(WithCastToInternal(device, &pDevice)); if (retVal != CL_SUCCESS) { return retVal; @@ -5290,7 +5291,7 @@ cl_int CL_API_CALL clEnqueueNDRangeKernelINTEL(cl_command_queue commandQueue, gtpinNotifyKernelSubmit(kernel, pCommandQueue); } - pCommandQueue->getDevice().allocateSyncBufferHandler(); + platform()->clDeviceMap[&pCommandQueue->getDevice()]->allocateSyncBufferHandler(); retVal = pCommandQueue->enqueueKernel( kernel, diff --git a/runtime/built_ins/built_ins.cpp b/runtime/built_ins/built_ins.cpp index 16e6615e2b..efa28b32db 100644 --- a/runtime/built_ins/built_ins.cpp +++ b/runtime/built_ins/built_ins.cpp @@ -47,7 +47,7 @@ SchedulerKernel &BuiltIns::getSchedulerKernel(Context &context) { auto initializeSchedulerProgramAndKernel = [&] { cl_int retVal = CL_SUCCESS; - auto src = context.getDevice(0)->getExecutionEnvironment()->getBuiltIns()->builtinsLib->getBuiltinCode(EBuiltInOps::Scheduler, BuiltinCode::ECodeType::Any, *context.getDevice(0)); + auto src = context.getDevice(0)->getExecutionEnvironment()->getBuiltIns()->builtinsLib->getBuiltinCode(EBuiltInOps::Scheduler, BuiltinCode::ECodeType::Any, context.getDevice(0)->getDevice()); auto program = Program::createFromGenBinary(*context.getDevice(0)->getExecutionEnvironment(), &context, @@ -179,9 +179,8 @@ Program *BuiltIns::createBuiltInProgram( &device.getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, context, device); builtinsBuilders["block_advanced_motion_estimate_bidirectional_check_intel"] = &device.getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, context, device); - const cl_device_id clDevice = &device; errcodeRet = pBuiltInProgram->build( - clDevice, + &device, mediaKernelsBuildOptions, enableCacheing, builtinsBuilders); diff --git a/runtime/command_queue/command_queue.cpp b/runtime/command_queue/command_queue.cpp index c75d2ccd1a..70c079fa59 100644 --- a/runtime/command_queue/command_queue.cpp +++ b/runtime/command_queue/command_queue.cpp @@ -44,7 +44,7 @@ namespace NEO { CommandQueueCreateFunc commandQueueFactory[IGFX_MAX_CORE] = {}; CommandQueue *CommandQueue::create(Context *context, - Device *device, + ClDevice *device, const cl_queue_properties *properties, cl_int &retVal) { retVal = CL_SUCCESS; @@ -58,8 +58,8 @@ CommandQueue *CommandQueue::create(Context *context, CommandQueue::CommandQueue() : CommandQueue(nullptr, nullptr, 0) { } -CommandQueue::CommandQueue(Context *context, Device *deviceId, const cl_queue_properties *properties) - : context(context), device(deviceId) { +CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_properties *properties) + : context(context), device(device) { if (context) { context->incRefInternal(); } @@ -119,6 +119,10 @@ CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver() const { return nullptr; } +Device &CommandQueue::getDevice() const noexcept { + return device->getDevice(); +} + uint32_t CommandQueue::getHwTag() const { uint32_t tag = *getHwTagAddress(); return tag; @@ -414,7 +418,6 @@ void *CommandQueue::enqueueMapBuffer(Buffer *buffer, cl_bool blockingMap, size_t size, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event, cl_int &errcodeRet) { - TransferProperties transferProperties(buffer, CL_COMMAND_MAP_BUFFER, mapFlags, blockingMap != CL_FALSE, &offset, &size, nullptr, false); EventsRequest eventsRequest(numEventsInWaitList, eventWaitList, event); @@ -454,7 +457,6 @@ void *CommandQueue::enqueueMapImage(Image *image, cl_bool blockingMap, } cl_int CommandQueue::enqueueUnmapMemObject(MemObj *memObj, void *mappedPtr, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) { - TransferProperties transferProperties(memObj, CL_COMMAND_UNMAP_MEM_OBJECT, 0, false, nullptr, nullptr, mappedPtr, false); EventsRequest eventsRequest(numEventsInWaitList, eventWaitList, event); diff --git a/runtime/command_queue/command_queue.h b/runtime/command_queue/command_queue.h index 0cd0479bef..202ebda315 100644 --- a/runtime/command_queue/command_queue.h +++ b/runtime/command_queue/command_queue.h @@ -19,6 +19,7 @@ namespace NEO { class BarrierCommand; class Buffer; class LinearStream; +class ClDevice; class Context; class Device; class Event; @@ -55,13 +56,13 @@ class CommandQueue : public BaseObject<_cl_command_queue> { public: static const cl_ulong objectMagic = 0x1234567890987654LL; - static CommandQueue *create(Context *context, Device *device, + static CommandQueue *create(Context *context, ClDevice *device, const cl_queue_properties *properties, cl_int &errcodeRet); CommandQueue(); - CommandQueue(Context *context, Device *device, + CommandQueue(Context *context, ClDevice *device, const cl_queue_properties *properties); CommandQueue &operator=(const CommandQueue &) = delete; @@ -336,7 +337,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> { MOCKABLE_VIRTUAL CommandStreamReceiver &getGpgpuCommandStreamReceiver() const; CommandStreamReceiver *getBcsCommandStreamReceiver() const; - Device &getDevice() const { return *device; } + Device &getDevice() const noexcept; Context &getContext() const { return *context; } Context *getContextPtr() const { return context; } EngineControl &getGpgpuEngine() const { return *gpgpuEngine; } @@ -445,7 +446,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> { void aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo); Context *context = nullptr; - Device *device = nullptr; + ClDevice *device = nullptr; EngineControl *gpgpuEngine = nullptr; EngineControl *bcsEngine = nullptr; @@ -467,6 +468,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> { }; typedef CommandQueue *(*CommandQueueCreateFunc)( - Context *context, Device *device, const cl_queue_properties *properties); + Context *context, ClDevice *device, const cl_queue_properties *properties); } // namespace NEO diff --git a/runtime/command_queue/command_queue_hw.h b/runtime/command_queue/command_queue_hw.h index c32571ebf6..569c60880e 100644 --- a/runtime/command_queue/command_queue_hw.h +++ b/runtime/command_queue/command_queue_hw.h @@ -32,7 +32,7 @@ class CommandQueueHw : public CommandQueue { public: CommandQueueHw(Context *context, - Device *device, + ClDevice *device, const cl_queue_properties *properties) : BaseClass(context, device, properties) { auto clPriority = getCmdQueueProperties(properties, CL_QUEUE_PRIORITY_KHR); @@ -68,7 +68,7 @@ class CommandQueueHw : public CommandQueue { } static CommandQueue *create(Context *context, - Device *device, + ClDevice *device, const cl_queue_properties *properties) { return new CommandQueueHw(context, device, properties); } diff --git a/runtime/command_queue/enqueue_common.h b/runtime/command_queue/enqueue_common.h index 586d39f484..923b1ce485 100644 --- a/runtime/command_queue/enqueue_common.h +++ b/runtime/command_queue/enqueue_common.h @@ -557,7 +557,7 @@ void CommandQueueHw::processDeviceEnqueue(DeviceQueueHw *d this->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u).getGraphicsAllocation(), devQueueHw->getDebugQueue()); - auto preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo); + auto preemptionMode = PreemptionHelper::taskPreemptionMode(getDevice(), multiDispatchInfo); GpgpuWalkerHelper::dispatchScheduler( *this->commandStream, *devQueueHw, @@ -731,7 +731,7 @@ CompletionStamp CommandQueueHw::enqueueNonBlocked( {}, //pipelineSelectArgs this->flushStamp->getStampReference(), //flushStampReference getThrottle(), //throttle - PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo), //preemptionMode + PreemptionHelper::taskPreemptionMode(getDevice(), multiDispatchInfo), //preemptionMode numGrfRequired, //numGrfRequired L3CachingSettings::l3CacheOn, //l3CacheSettings kernel->getThreadArbitrationPolicy(), //threadArbitrationPolicy @@ -786,7 +786,7 @@ CompletionStamp CommandQueueHw::enqueueNonBlocked( getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u), taskLevel, dispatchFlags, - *device); + getDevice()); return completionStamp; } @@ -859,7 +859,7 @@ void CommandQueueHw::enqueueBlocked( allSurfaces.push_back(surface->duplicate()); } - PreemptionMode preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo); + PreemptionMode preemptionMode = PreemptionHelper::taskPreemptionMode(getDevice(), multiDispatchInfo); bool slmUsed = multiDispatchInfo.usesSlm() || multiDispatchInfo.peekParentKernel(); command = std::make_unique(*this, blockedCommandsData, @@ -955,7 +955,7 @@ CompletionStamp CommandQueueHw::enqueueCommandWithoutKernel( getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u), taskLevel, dispatchFlags, - *device); + getDevice()); return completionStamp; } diff --git a/runtime/context/context.cpp b/runtime/context/context.cpp index c9b6042808..14a8b22da9 100644 --- a/runtime/context/context.cpp +++ b/runtime/context/context.cpp @@ -95,7 +95,7 @@ bool Context::areMultiStorageAllocationsPreferred() { } bool Context::createImpl(const cl_context_properties *properties, - const DeviceVector &inputDevices, + const ClDeviceVector &inputDevices, void(CL_CALLBACK *funcNotify)(const char *, const void *, size_t, void *), void *data, cl_int &errcodeRet) { @@ -257,8 +257,8 @@ size_t Context::getTotalNumDevices() const { return numAvailableDevices; } -Device *Context::getDevice(size_t deviceOrdinal) { - return (Device *)devices[deviceOrdinal]; +ClDevice *Context::getDevice(size_t deviceOrdinal) { + return (ClDevice *)devices[deviceOrdinal]; } cl_int Context::getSupportedImageFormats( diff --git a/runtime/context/context.h b/runtime/context/context.h index e8f7f9d947..05c36fd316 100644 --- a/runtime/context/context.h +++ b/runtime/context/context.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -41,13 +41,13 @@ class Context : public BaseObject<_cl_context> { static const cl_ulong objectMagic = 0xA4234321DC002130LL; bool createImpl(const cl_context_properties *properties, - const DeviceVector &devices, + const ClDeviceVector &devices, void(CL_CALLBACK *pfnNotify)(const char *, const void *, size_t, void *), void *userData, cl_int &errcodeRet); template static T *create(const cl_context_properties *properties, - const DeviceVector &devices, + const ClDeviceVector &devices, void(CL_CALLBACK *funcNotify)(const char *, const void *, size_t, void *), void *data, cl_int &errcodeRet) { @@ -75,7 +75,7 @@ class Context : public BaseObject<_cl_context> { size_t getNumDevices() const; size_t getTotalNumDevices() const; - Device *getDevice(size_t deviceOrdinal); + ClDevice *getDevice(size_t deviceOrdinal); MemoryManager *getMemoryManager() { return memoryManager; @@ -150,7 +150,7 @@ class Context : public BaseObject<_cl_context> { void(CL_CALLBACK *contextCallback)(const char *, const void *, size_t, void *); void *userData; - DeviceVector devices; + ClDeviceVector devices; MemoryManager *memoryManager; SVMAllocsManager *svmAllocsManager = nullptr; CommandQueue *specialQueue; diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 640a64d493..f4fa645773 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -19,6 +19,7 @@ #include "runtime/memory_manager/memory_manager.h" #include "runtime/os_interface/os_interface.h" #include "runtime/os_interface/os_time.h" +#include "runtime/platform/platform.h" #include "runtime/source_level_debugger/source_level_debugger.h" namespace NEO { @@ -26,14 +27,96 @@ namespace NEO { decltype(&PerformanceCounters::create) Device::createPerformanceCountersFunc = PerformanceCounters::create; extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex); -DeviceVector::DeviceVector(const cl_device_id *devices, - cl_uint numDevices) { - for (cl_uint i = 0; i < numDevices; i++) { - this->push_back(castToObject(devices[i])); +ClDevice::ClDevice(Device &device) : device(device), platformId(platform()) { + device.incRefInternal(); + initializeCaps(); + + auto numAvailableDevices = device.getNumAvailableDevices(); + if (numAvailableDevices > 1) { + for (uint32_t i = 0; i < numAvailableDevices; i++) { + subDevices.push_back(std::make_unique(*device.getDeviceById(i))); + platform()->clDeviceMap.emplace(device.getDeviceById(i), subDevices[i].get()); + } } } -void DeviceVector::toDeviceIDs(std::vector &devIDs) { +ClDevice::~ClDevice() { + syncBufferHandler.reset(); + for (auto &subDevice : subDevices) { + subDevice.reset(); + } + device.decRefInternal(); +} + +void ClDevice::allocateSyncBufferHandler() { + TakeOwnershipWrapper lock(*this); + if (syncBufferHandler.get() == nullptr) { + syncBufferHandler = std::make_unique(this->getDevice()); + UNRECOVERABLE_IF(syncBufferHandler.get() == nullptr); + } +} + +unsigned int ClDevice::getEnabledClVersion() const { return device.getEnabledClVersion(); } +unsigned int ClDevice::getSupportedClVersion() const { return device.getSupportedClVersion(); } + +void ClDevice::retainApi() { + if (!device.isReleasable()) { + DEBUG_BREAK_IF(true); + } else { + platform()->getClDevice(device.getRootDeviceIndex())->incRefInternal(); + this->incRefApi(); + } +}; +unique_ptr_if_unused ClDevice::releaseApi() { + if (!device.isReleasable()) { + DEBUG_BREAK_IF(true); + return unique_ptr_if_unused(this, false); + } + platform()->getClDevice(device.getRootDeviceIndex())->decRefInternal(); + return this->decRefApi(); +} + +ClDevice *ClDevice::getDeviceById(uint32_t deviceId) { + UNRECOVERABLE_IF(deviceId >= getNumAvailableDevices()); + if (subDevices.empty()) { + return this; + } + return subDevices[deviceId].get(); +} + +bool ClDevice::getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const { return device.getDeviceAndHostTimer(deviceTimestamp, hostTimestamp); } +bool ClDevice::getHostTimer(uint64_t *hostTimestamp) const { return device.getHostTimer(hostTimestamp); } +const HardwareInfo &ClDevice::getHardwareInfo() const { return device.getHardwareInfo(); } +const DeviceInfo &ClDevice::getDeviceInfo() const { return device.getDeviceInfo(); } +EngineControl &ClDevice::getEngine(aub_stream::EngineType engineType, bool lowPriority) { return device.getEngine(engineType, lowPriority); } +EngineControl &ClDevice::getDefaultEngine() { return device.getDefaultEngine(); } +MemoryManager *ClDevice::getMemoryManager() const { return device.getMemoryManager(); } +GmmHelper *ClDevice::getGmmHelper() const { return device.getGmmHelper(); } +double ClDevice::getProfilingTimerResolution() { return device.getProfilingTimerResolution(); } +double ClDevice::getPlatformHostTimerResolution() const { return device.getPlatformHostTimerResolution(); } +bool ClDevice::isSimulation() const { return device.isSimulation(); } +GFXCORE_FAMILY ClDevice::getRenderCoreFamily() const { return device.getRenderCoreFamily(); } +PerformanceCounters *ClDevice::getPerformanceCounters() { return device.getPerformanceCounters(); } +PreemptionMode ClDevice::getPreemptionMode() const { return device.getPreemptionMode(); } +bool ClDevice::isSourceLevelDebuggerActive() const { return device.isSourceLevelDebuggerActive(); } +SourceLevelDebugger *ClDevice::getSourceLevelDebugger() { return device.getSourceLevelDebugger(); } +ExecutionEnvironment *ClDevice::getExecutionEnvironment() const { return device.getExecutionEnvironment(); } +const RootDeviceEnvironment &ClDevice::getRootDeviceEnvironment() const { return device.getRootDeviceEnvironment(); } +const HardwareCapabilities &ClDevice::getHardwareCapabilities() const { return device.getHardwareCapabilities(); } +bool ClDevice::isFullRangeSvm() const { return device.isFullRangeSvm(); } +bool ClDevice::areSharedSystemAllocationsAllowed() const { return device.areSharedSystemAllocationsAllowed(); } +uint32_t ClDevice::getRootDeviceIndex() const { return device.getRootDeviceIndex(); } +uint32_t ClDevice::getNumAvailableDevices() const { return device.getNumAvailableDevices(); } + +ClDeviceVector::ClDeviceVector(const cl_device_id *devices, + cl_uint numDevices) { + for (cl_uint i = 0; i < numDevices; i++) { + auto pClDevice = castToObject(devices[i]); + this->push_back(pClDevice); + } +} + +void ClDeviceVector::toDeviceIDs(std::vector &devIDs) { int i = 0; devIDs.resize(this->size()); @@ -61,7 +144,6 @@ Device::Device(ExecutionEnvironment *executionEnvironment) Device::~Device() { DEBUG_BREAK_IF(nullptr == executionEnvironment->memoryManager.get()); - syncBufferHandler.reset(); if (performanceCounters) { performanceCounters->shutdown(); } @@ -206,14 +288,6 @@ double Device::getPlatformHostTimerResolution() const { return 0.0; } -void Device::allocateSyncBufferHandler() { - TakeOwnershipWrapper lock(*this); - if (syncBufferHandler.get() == nullptr) { - syncBufferHandler = std::make_unique(*this); - UNRECOVERABLE_IF(syncBufferHandler.get() == nullptr); - } -} - GFXCORE_FAMILY Device::getRenderCoreFamily() const { return this->getHardwareInfo().platform.eRenderCoreFamily; } diff --git a/runtime/device/device.h b/runtime/device/device.h index 25e14de9dc..5e225f19d7 100644 --- a/runtime/device/device.h +++ b/runtime/device/device.h @@ -18,22 +18,56 @@ #include "engine_node.h" namespace NEO { +class Device; class DriverInfo; class OSTime; class SyncBufferHandler; template <> struct OpenCLObjectMapper<_cl_device_id> { - typedef class Device DerivedType; + typedef class ClDevice DerivedType; }; -class Device : public BaseObject<_cl_device_id> { +class ClDevice : public BaseObject<_cl_device_id> { public: static const cl_ulong objectMagic = 0x8055832341AC8D08LL; - Device &operator=(const Device &) = delete; - Device(const Device &) = delete; - ~Device() override; + ClDevice &operator=(const ClDevice &) = delete; + ClDevice(const ClDevice &) = delete; + + explicit ClDevice(Device &device); + ~ClDevice() override; + + unsigned int getEnabledClVersion() const; //CL + unsigned int getSupportedClVersion() const; + + void retainApi(); + unique_ptr_if_unused releaseApi(); + + bool getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const; + bool getHostTimer(uint64_t *hostTimestamp) const; + const HardwareInfo &getHardwareInfo() const; + const DeviceInfo &getDeviceInfo() const; + EngineControl &getEngine(aub_stream::EngineType engineType, bool lowPriority); + EngineControl &getDefaultEngine(); + MemoryManager *getMemoryManager() const; + GmmHelper *getGmmHelper() const; + double getProfilingTimerResolution(); + double getPlatformHostTimerResolution() const; + bool isSimulation() const; + GFXCORE_FAMILY getRenderCoreFamily() const; + void allocateSyncBufferHandler(); + PerformanceCounters *getPerformanceCounters(); + PreemptionMode getPreemptionMode() const; + bool isSourceLevelDebuggerActive() const; + SourceLevelDebugger *getSourceLevelDebugger(); + ExecutionEnvironment *getExecutionEnvironment() const; + const RootDeviceEnvironment &getRootDeviceEnvironment() const; + const HardwareCapabilities &getHardwareCapabilities() const; + bool isFullRangeSvm() const; + bool areSharedSystemAllocationsAllowed() const; + uint32_t getRootDeviceIndex() const; + uint32_t getNumAvailableDevices() const; // API entry points cl_int getDeviceInfo(cl_device_info paramName, @@ -56,8 +90,30 @@ class Device : public BaseObject<_cl_device_id> { void getStr(const void *&src, size_t &size, size_t &retSize); + + constexpr Device &getDevice() const noexcept { return device; } + ClDevice *getDeviceById(uint32_t deviceId); + void initializeCaps(); + std::unique_ptr syncBufferHandler; + + protected: + Device &device; + std::vector> subDevices; + cl_platform_id platformId; + + std::vector simultaneousInterops = {0}; + void appendOSExtensions(std::string &deviceExtensions); +}; + +class Device : public ReferenceTrackedObject { + public: + Device &operator=(const Device &) = delete; + Device(const Device &) = delete; + ~Device() override; + unsigned int getEnabledClVersion() const { return enabledClVersion; }; unsigned int getSupportedClVersion() const; + void appendOSExtensions(const std::string &newExtensions); template static DeviceT *create(ArgsT &&... args) { @@ -65,6 +121,8 @@ class Device : public BaseObject<_cl_device_id> { return createDeviceInternals(device); } + virtual bool isReleasable() = 0; + bool getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const; bool getHostTimer(uint64_t *hostTimestamp) const; const HardwareInfo &getHardwareInfo() const; @@ -78,7 +136,6 @@ class Device : public BaseObject<_cl_device_id> { double getPlatformHostTimerResolution() const; bool isSimulation() const; GFXCORE_FAMILY getRenderCoreFamily() const; - void allocateSyncBufferHandler(); PerformanceCounters *getPerformanceCounters() { return performanceCounters.get(); } PreemptionMode getPreemptionMode() const { return preemptionMode; } MOCKABLE_VIRTUAL bool isSourceLevelDebuggerActive() const; @@ -99,7 +156,6 @@ class Device : public BaseObject<_cl_device_id> { virtual DeviceBitfield getDeviceBitfield() const = 0; static decltype(&PerformanceCounters::create) createPerformanceCountersFunc; - std::unique_ptr syncBufferHandler; protected: Device() = delete; @@ -107,7 +163,6 @@ class Device : public BaseObject<_cl_device_id> { MOCKABLE_VIRTUAL void initializeCaps(); void setupFp64Flags(); - void appendOSExtensions(std::string &deviceExtensions); template static T *createDeviceInternals(T *device) { @@ -123,7 +178,6 @@ class Device : public BaseObject<_cl_device_id> { bool createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engineType); MOCKABLE_VIRTUAL std::unique_ptr createCommandStreamReceiver() const; - std::vector simultaneousInterops; unsigned int enabledClVersion = 0u; std::string deviceExtensions; std::string exposedBuiltinKernels = ""; @@ -143,10 +197,10 @@ class Device : public BaseObject<_cl_device_id> { }; template -inline void Device::getCap(const void *&src, - size_t &size, - size_t &retSize) { - src = &DeviceInfoTable::Map::getValue(deviceInfo); +inline void ClDevice::getCap(const void *&src, + size_t &size, + size_t &retSize) { + src = &DeviceInfoTable::Map::getValue(device.getDeviceInfo()); retSize = size = DeviceInfoTable::Map::size; } diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 7a4d193fa8..d175195518 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -183,9 +183,6 @@ void Device::initializeCaps() { deviceExtensions += sharingFactory.getExtensions(); - simultaneousInterops = {0}; - appendOSExtensions(deviceExtensions); - deviceExtensions += hwHelper.getExtensions(); deviceInfo.deviceExtensions = deviceExtensions.c_str(); @@ -385,4 +382,10 @@ void Device::initializeCaps() { } } } + +void Device::appendOSExtensions(const std::string &newExtensions) { + deviceExtensions += newExtensions; + deviceInfo.deviceExtensions = deviceExtensions.c_str(); +} + } // namespace NEO diff --git a/runtime/device/device_info.cpp b/runtime/device/device_info.cpp index 7a41e210db..5fdda8e8b8 100644 --- a/runtime/device/device_info.cpp +++ b/runtime/device/device_info.cpp @@ -20,53 +20,50 @@ using DeviceInfoTable::Map; namespace NEO { template -inline void Device::getStr(const void *&src, - size_t &size, - size_t &retSize) { - src = Map::getValue(deviceInfo); - retSize = size = strlen(Map::getValue(deviceInfo)) + 1; +inline void ClDevice::getStr(const void *&src, + size_t &size, + size_t &retSize) { + src = Map::getValue(device.getDeviceInfo()); + retSize = size = strlen(Map::getValue(device.getDeviceInfo())) + 1; } template <> -inline void Device::getCap(const void *&src, - size_t &size, - size_t &retSize) { - src = deviceInfo.maxWorkItemSizes; - retSize = size = sizeof(deviceInfo.maxWorkItemSizes); +inline void ClDevice::getCap(const void *&src, + size_t &size, + size_t &retSize) { + src = device.getDeviceInfo().maxWorkItemSizes; + retSize = size = sizeof(device.getDeviceInfo().maxWorkItemSizes); } template <> -inline void Device::getCap(const void *&src, - size_t &size, - size_t &retSize) { +inline void ClDevice::getCap(const void *&src, + size_t &size, + size_t &retSize) { static cl_device_partition_property property = 0; src = &property; retSize = size = sizeof(cl_device_partition_property *); } template <> -inline void Device::getCap(const void *&src, - size_t &size, - size_t &retSize) { - // This isn't referenced externally but because we're passing a pointer to a pointer, - // we need a persistent location - static cl_platform_id pPlatform = platform(); - src = &pPlatform; +inline void ClDevice::getCap(const void *&src, + size_t &size, + size_t &retSize) { + src = &platformId; retSize = size = sizeof(cl_platform_id); } template <> -inline void Device::getCap(const void *&src, - size_t &size, - size_t &retSize) { - src = deviceInfo.maxSubGroups; - retSize = size = sizeof(deviceInfo.maxSubGroups); +inline void ClDevice::getCap(const void *&src, + size_t &size, + size_t &retSize) { + src = device.getDeviceInfo().maxSubGroups; + retSize = size = sizeof(device.getDeviceInfo().maxSubGroups); } -cl_int Device::getDeviceInfo(cl_device_info paramName, - size_t paramValueSize, - void *paramValue, - size_t *paramValueSizeRet) { +cl_int ClDevice::getDeviceInfo(cl_device_info paramName, + size_t paramValueSize, + void *paramValue, + size_t *paramValueSizeRet) { cl_int retVal = CL_INVALID_VALUE; size_t srcSize = 0; size_t retSize = 0; @@ -192,10 +189,10 @@ cl_int Device::getDeviceInfo(cl_device_info paramName, break; } default: - if (deviceInfo.imageSupport && getDeviceInfoForImage(paramName, src, srcSize, retSize)) { + if (device.getDeviceInfo().imageSupport && getDeviceInfoForImage(paramName, src, srcSize, retSize)) { break; } - DeviceHelper::getExtraDeviceInfo(getHardwareInfo(), paramName, param, src, srcSize, retSize); + DeviceHelper::getExtraDeviceInfo(device.getHardwareInfo(), paramName, param, src, srcSize, retSize); } retVal = ::getInfo(paramValue, paramValueSize, src, srcSize); @@ -207,10 +204,10 @@ cl_int Device::getDeviceInfo(cl_device_info paramName, return retVal; } -bool Device::getDeviceInfoForImage(cl_device_info paramName, - const void *&src, - size_t &srcSize, - size_t &retSize) { +bool ClDevice::getDeviceInfoForImage(cl_device_info paramName, + const void *&src, + size_t &srcSize, + size_t &retSize) { switch (paramName) { case CL_DEVICE_MAX_READ_IMAGE_ARGS: getCap(src, srcSize, retSize); @@ -249,11 +246,11 @@ bool Device::getDeviceInfoForImage(cl_device_info paramName, getCap(src, srcSize, retSize); break; case CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL: - if (deviceInfo.nv12Extension) + if (getDeviceInfo().nv12Extension) getCap(src, srcSize, retSize); break; case CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL: - if (deviceInfo.nv12Extension) + if (getDeviceInfo().nv12Extension) getCap(src, srcSize, retSize); break; default: diff --git a/runtime/device/device_vector.h b/runtime/device/device_vector.h index d2e8d10ba0..d29c0b2111 100644 --- a/runtime/device/device_vector.h +++ b/runtime/device/device_vector.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,14 +11,15 @@ #include namespace NEO { -class Device; -class DeviceVector : public std::vector { +class ClDevice; + +class ClDeviceVector : public std::vector { public: - DeviceVector() = default; - DeviceVector(const DeviceVector &) = default; - DeviceVector &operator=(const DeviceVector &) = default; - DeviceVector(const cl_device_id *devices, - cl_uint numDevices); + ClDeviceVector() = default; + ClDeviceVector(const ClDeviceVector &) = default; + ClDeviceVector &operator=(const ClDeviceVector &) = default; + ClDeviceVector(const cl_device_id *devices, + cl_uint numDevices); void toDeviceIDs(std::vector &devIDs); }; diff --git a/runtime/device/root_device.cpp b/runtime/device/root_device.cpp index 783f2c8f2d..a583e24a37 100644 --- a/runtime/device/root_device.cpp +++ b/runtime/device/root_device.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,13 @@ namespace NEO { RootDevice::RootDevice(ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) : Device(executionEnvironment), rootDeviceIndex(rootDeviceIndex) {} -RootDevice::~RootDevice() = default; +RootDevice::~RootDevice() { + for (auto subdevice : subdevices) { + if (subdevice) { + subdevice->decRefInternal(); + } + } +} uint32_t RootDevice::getNumSubDevices() const { return static_cast(subdevices.size()); @@ -36,7 +42,7 @@ Device *RootDevice::getDeviceById(uint32_t deviceId) const { if (subdevices.empty()) { return const_cast(this); } - return subdevices[deviceId].get(); + return subdevices[deviceId]; }; SubDevice *RootDevice::createSubDevice(uint32_t subDeviceIndex) { @@ -48,14 +54,16 @@ bool RootDevice::createDeviceImpl() { if (numSubDevices == 1) { numSubDevices = 0; } - subdevices.resize(numSubDevices); + UNRECOVERABLE_IF(!subdevices.empty()); + subdevices.resize(numSubDevices, nullptr); for (auto i = 0u; i < numSubDevices; i++) { auto subDevice = createSubDevice(i); if (!subDevice) { return false; } - subdevices[i].reset(subDevice); + subDevice->incRefInternal(); + subdevices[i] = subDevice; } auto status = Device::createDeviceImpl(); if (!status) { @@ -63,16 +71,9 @@ bool RootDevice::createDeviceImpl() { } return true; } - -/* We hide the retain and release function of BaseObject. */ -void RootDevice::retain() { - DEBUG_BREAK_IF(!isValid()); -} - -unique_ptr_if_unused RootDevice::release() { - DEBUG_BREAK_IF(!isValid()); - return unique_ptr_if_unused(this, false); -} +bool RootDevice::isReleasable() { + return false; +}; DeviceBitfield RootDevice::getDeviceBitfield() const { DeviceBitfield deviceBitfield{static_cast(maxNBitValue(getNumAvailableDevices()))}; return deviceBitfield; diff --git a/runtime/device/root_device.h b/runtime/device/root_device.h index f796e321e8..6e9ac338ba 100644 --- a/runtime/device/root_device.h +++ b/runtime/device/root_device.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,9 +20,7 @@ class RootDevice : public Device { uint32_t getNumAvailableDevices() const override; uint32_t getRootDeviceIndex() const override; Device *getDeviceById(uint32_t deviceId) const override; - /* We hide the retain and release function of BaseObject. */ - void retain() override; - unique_ptr_if_unused release() override; + bool isReleasable() override; uint32_t getNumSubDevices() const; @@ -33,7 +31,7 @@ class RootDevice : public Device { MOCKABLE_VIRTUAL bool initializeRootCommandStreamReceiver(); MOCKABLE_VIRTUAL SubDevice *createSubDevice(uint32_t subDeviceIndex); - std::vector> subdevices; + std::vector subdevices; const uint32_t rootDeviceIndex; }; } // namespace NEO diff --git a/runtime/device/sub_device.cpp b/runtime/device/sub_device.cpp index e156e70252..276547bc0c 100644 --- a/runtime/device/sub_device.cpp +++ b/runtime/device/sub_device.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,20 +12,9 @@ namespace NEO { SubDevice::SubDevice(ExecutionEnvironment *executionEnvironment, uint32_t subDeviceIndex, RootDevice &rootDevice) : Device(executionEnvironment), subDeviceIndex(subDeviceIndex), rootDevice(rootDevice) {} -void SubDevice::retain() { - rootDevice.incRefInternal(); - Device::retain(); +bool SubDevice::isReleasable() { + return true; }; -unique_ptr_if_unused SubDevice::release() { - rootDevice.decRefInternal(); - return Device::release(); -}; -void SubDevice::retainInternal() { - rootDevice.incRefInternal(); -} -void SubDevice::releaseInternal() { - rootDevice.decRefInternal(); -} DeviceBitfield SubDevice::getDeviceBitfield() const { DeviceBitfield deviceBitfield; diff --git a/runtime/device/sub_device.h b/runtime/device/sub_device.h index b47672a474..47d5e3ec0c 100644 --- a/runtime/device/sub_device.h +++ b/runtime/device/sub_device.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,10 +15,7 @@ class SubDevice : public Device { constexpr static uint32_t unspecifiedSubDeviceIndex = std::numeric_limits::max(); SubDevice(ExecutionEnvironment *executionEnvironment, uint32_t subDeviceIndex, RootDevice &rootDevice); - void retain() override; - unique_ptr_if_unused release() override; - void retainInternal(); - void releaseInternal(); + bool isReleasable() override; uint32_t getNumAvailableDevices() const override; uint32_t getRootDeviceIndex() const override; Device *getDeviceById(uint32_t deviceId) const override; diff --git a/runtime/device_queue/device_queue.cpp b/runtime/device_queue/device_queue.cpp index 8fb13e18fa..c340d2a6c1 100644 --- a/runtime/device_queue/device_queue.cpp +++ b/runtime/device_queue/device_queue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,7 +20,7 @@ DeviceQueueCreateFunc deviceQueueFactory[IGFX_MAX_CORE] = {}; const uint32_t DeviceQueue::numberOfDeviceEnqueues = 128; DeviceQueue::DeviceQueue(Context *context, - Device *device, + ClDevice *device, cl_queue_properties &properties) : DeviceQueue() { this->context = context; this->device = device; @@ -40,7 +40,7 @@ DeviceQueue::DeviceQueue(Context *context, initDeviceQueue(); } -DeviceQueue *DeviceQueue::create(Context *context, Device *device, +DeviceQueue *DeviceQueue::create(Context *context, ClDevice *device, const cl_queue_properties &properties, cl_int &errcodeRet) { errcodeRet = CL_SUCCESS; @@ -89,6 +89,10 @@ DeviceQueue::~DeviceQueue() { } } +Device &DeviceQueue::getDevice() { + return device->getDevice(); +} + cl_int DeviceQueue::getCommandQueueInfo(cl_command_queue_info paramName, size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) { diff --git a/runtime/device_queue/device_queue.h b/runtime/device_queue/device_queue.h index 493865be7b..b9386fed67 100644 --- a/runtime/device_queue/device_queue.h +++ b/runtime/device_queue/device_queue.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,6 +14,7 @@ #include "runtime/helpers/base_object.h" namespace NEO { +class ClDevice; class CommandQueue; class Context; class Device; @@ -40,10 +41,10 @@ class DeviceQueue : public BaseObject<_device_queue> { } offsetDsh = 0; } - DeviceQueue(Context *context, Device *device, cl_queue_properties &properties); + DeviceQueue(Context *context, ClDevice *device, cl_queue_properties &properties); ~DeviceQueue() override; - Device &getDevice() { return *device; } + Device &getDevice(); Context &getContext() { return *context; } cl_uint getQueueSize() { return queueSize; } cl_command_queue_properties getCommandQueueProperties() const { return commandQueueProperties; } @@ -60,7 +61,7 @@ class DeviceQueue : public BaseObject<_device_queue> { } static DeviceQueue *create(Context *context, - Device *device, + ClDevice *device, const cl_queue_properties &properties, cl_int &errcodeRet); @@ -111,7 +112,7 @@ class DeviceQueue : public BaseObject<_device_queue> { void initDeviceQueue(); Context *context = nullptr; - Device *device = nullptr; + ClDevice *device = nullptr; cl_command_queue_properties commandQueueProperties = 0; cl_uint queueSize = 0; @@ -130,5 +131,5 @@ class DeviceQueue : public BaseObject<_device_queue> { }; typedef DeviceQueue *(*DeviceQueueCreateFunc)( - Context *context, Device *device, cl_queue_properties &properties); + Context *context, ClDevice *device, cl_queue_properties &properties); } // namespace NEO diff --git a/runtime/device_queue/device_queue_hw.h b/runtime/device_queue/device_queue_hw.h index 149158babf..9808a207b0 100644 --- a/runtime/device_queue/device_queue_hw.h +++ b/runtime/device_queue/device_queue_hw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -34,7 +34,7 @@ class DeviceQueueHw : public DeviceQueue { public: DeviceQueueHw(Context *context, - Device *device, + ClDevice *device, cl_queue_properties &properties) : BaseClass(context, device, properties) { allocateSlbBuffer(); offsetDsh = colorCalcStateSize + (uint32_t)sizeof(INTERFACE_DESCRIPTOR_DATA) * interfaceDescriptorEntries * numberOfIDTables; @@ -42,7 +42,7 @@ class DeviceQueueHw : public DeviceQueue { } static DeviceQueue *create(Context *context, - Device *device, + ClDevice *device, cl_queue_properties &properties) { return new (std::nothrow) DeviceQueueHw(context, device, properties); } diff --git a/runtime/helpers/built_ins_helper.cpp b/runtime/helpers/built_ins_helper.cpp index 6de2926870..d902bdac07 100644 --- a/runtime/helpers/built_ins_helper.cpp +++ b/runtime/helpers/built_ins_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,8 +11,8 @@ #include "runtime/program/program.h" namespace NEO { -const SipKernel &initSipKernel(SipKernelType type, Device &device) { - return device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(type, device); +const SipKernel &initSipKernel(SipKernelType type, ClDevice &device) { + return device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(type, device.getDevice()); } Program *createProgramForSip(ExecutionEnvironment &executionEnvironment, Context *context, diff --git a/runtime/helpers/built_ins_helper.h b/runtime/helpers/built_ins_helper.h index 2c2129790e..1bedccc484 100644 --- a/runtime/helpers/built_ins_helper.h +++ b/runtime/helpers/built_ins_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,8 +10,9 @@ #include "runtime/execution_environment/execution_environment.h" namespace NEO { +class ClDevice; -const SipKernel &initSipKernel(SipKernelType type, Device &device); +const SipKernel &initSipKernel(SipKernelType type, ClDevice &device); Program *createProgramForSip(ExecutionEnvironment &executionEnvironment, Context *context, std::vector &binary, diff --git a/runtime/helpers/queue_helpers.cpp b/runtime/helpers/queue_helpers.cpp index 553f166910..ad38756ae6 100644 --- a/runtime/helpers/queue_helpers.cpp +++ b/runtime/helpers/queue_helpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,7 +12,7 @@ bool isExtraToken(const cl_queue_properties *property) { return false; } -bool verifyExtraTokens(Device *&device, Context &context, const cl_queue_properties *properties) { +bool verifyExtraTokens(ClDevice *&device, Context &context, const cl_queue_properties *properties) { return true; } diff --git a/runtime/helpers/queue_helpers.h b/runtime/helpers/queue_helpers.h index 8ce2580cfb..accd0f45cc 100644 --- a/runtime/helpers/queue_helpers.h +++ b/runtime/helpers/queue_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "runtime/command_queue/command_queue.h" #include "runtime/device_queue/device_queue.h" #include "runtime/helpers/get_info.h" +#include "runtime/platform/platform.h" namespace NEO { @@ -61,7 +62,7 @@ cl_int getQueueInfo(QueueType *queue, getInfoHelper.set(&queue->getContext()); break; case CL_QUEUE_DEVICE: - getInfoHelper.set(&queue->getDevice()); + getInfoHelper.set(platform()->clDeviceMap[&queue->getDevice()]); break; case CL_QUEUE_REFERENCE_COUNT: getInfoHelper.set(queue->getReference()); @@ -123,5 +124,5 @@ returnType getCmdQueueProperties(const cl_queue_properties *properties, return retVal; } bool isExtraToken(const cl_queue_properties *property); -bool verifyExtraTokens(Device *&device, Context &context, const cl_queue_properties *properties); +bool verifyExtraTokens(ClDevice *&device, Context &context, const cl_queue_properties *properties); } // namespace NEO diff --git a/runtime/helpers/validators.cpp b/runtime/helpers/validators.cpp index 2938526639..c3adccf9d6 100644 --- a/runtime/helpers/validators.cpp +++ b/runtime/helpers/validators.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ cl_int validateObject(cl_context object) { } cl_int validateObject(cl_device_id object) { - return castToObject(object) != nullptr + return castToObject(object) != nullptr ? CL_SUCCESS : CL_INVALID_DEVICE; } diff --git a/runtime/kernel/kernel.cpp b/runtime/kernel/kernel.cpp index 95b3c20079..ff5f2b8445 100644 --- a/runtime/kernel/kernel.cpp +++ b/runtime/kernel/kernel.cpp @@ -55,7 +55,7 @@ class Surface; uint32_t Kernel::dummyPatchLocation = 0xbaddf00d; -Kernel::Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg, bool schedulerKernel) +Kernel::Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg, bool schedulerKernel) : globalWorkOffsetX(&Kernel::dummyPatchLocation), globalWorkOffsetY(&Kernel::dummyPatchLocation), globalWorkOffsetZ(&Kernel::dummyPatchLocation), @@ -2231,7 +2231,7 @@ void Kernel::patchSyncBuffer(Device &device, GraphicsAllocation *gfxAllocation, patchInfo.pAllocateSyncBuffer->SurfaceStateHeapOffset); auto addressToPatch = gfxAllocation->getUnderlyingBuffer(); auto sizeToPatch = gfxAllocation->getUnderlyingBufferSize(); - Buffer::setSurfaceState(&device, surfaceState, sizeToPatch, addressToPatch, gfxAllocation); + Buffer::setSurfaceState(platform()->clDeviceMap[&device], surfaceState, sizeToPatch, addressToPatch, gfxAllocation); } } diff --git a/runtime/kernel/kernel.h b/runtime/kernel/kernel.h index 50a5620e8c..fdc236c97e 100644 --- a/runtime/kernel/kernel.h +++ b/runtime/kernel/kernel.h @@ -190,7 +190,7 @@ class Kernel : public BaseObject<_cl_kernel> { return kernelInfo; } - const Device &getDevice() const { + const ClDevice &getDevice() const { return device; } @@ -479,7 +479,7 @@ class Kernel : public BaseObject<_cl_kernel> { void patchWithImplicitSurface(void *ptrToPatchInCrossThreadData, GraphicsAllocation &allocation, const PatchTokenT &patch); void getParentObjectCounts(ObjectCounts &objectCount); - Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg, bool schedulerKernel = false); + Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg, bool schedulerKernel = false); void provideInitializationHints(); void patchBlocksCurbeWithConstantValues(); @@ -492,7 +492,7 @@ class Kernel : public BaseObject<_cl_kernel> { bool allocationForCacheFlush(GraphicsAllocation *argAllocation) const; Program *program; Context *context; - const Device &device; + const ClDevice &device; const KernelInfo &kernelInfo; std::vector kernelArguments; diff --git a/runtime/mem_obj/buffer.cpp b/runtime/mem_obj/buffer.cpp index dd3a75e47f..2d20541e40 100644 --- a/runtime/mem_obj/buffer.cpp +++ b/runtime/mem_obj/buffer.cpp @@ -526,7 +526,7 @@ Buffer *Buffer::createBufferHw(Context *context, return pBuffer; } -Buffer *Buffer::createBufferHwFromDevice(const Device *device, +Buffer *Buffer::createBufferHwFromDevice(const ClDevice *device, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, size_t size, @@ -572,7 +572,7 @@ uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) cons } } -void Buffer::setSurfaceState(const Device *device, +void Buffer::setSurfaceState(const ClDevice *device, void *surfaceState, size_t svmSize, void *svmPtr, diff --git a/runtime/mem_obj/buffer.h b/runtime/mem_obj/buffer.h index 6b36ba0dfb..c5df0538de 100644 --- a/runtime/mem_obj/buffer.h +++ b/runtime/mem_obj/buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,7 +17,7 @@ namespace NEO { class Buffer; -class Device; +class ClDevice; class MemoryManager; typedef Buffer *(*BufferCreatFunc)(Context *context, @@ -87,7 +87,7 @@ class Buffer : public MemObj { bool isHostPtrSVM, bool isImageRedescribed); - static Buffer *createBufferHwFromDevice(const Device *device, + static Buffer *createBufferHwFromDevice(const ClDevice *device, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, size_t size, @@ -103,7 +103,7 @@ class Buffer : public MemObj { const cl_buffer_region *region, cl_int &errcodeRet); - static void setSurfaceState(const Device *device, + static void setSurfaceState(const ClDevice *device, void *surfaceState, size_t svmSize, void *svmPtr, diff --git a/runtime/mem_obj/image.cpp b/runtime/mem_obj/image.cpp index b0be968b58..743a987b83 100644 --- a/runtime/mem_obj/image.cpp +++ b/runtime/mem_obj/image.cpp @@ -28,6 +28,7 @@ #include "runtime/mem_obj/buffer.h" #include "runtime/mem_obj/mem_obj_helper.h" #include "runtime/memory_manager/memory_manager.h" +#include "runtime/platform/platform.h" #include "igfxfmid.h" @@ -442,7 +443,7 @@ cl_int Image::validate(Context *context, const ClSurfaceFormatInfo *surfaceFormat, const cl_image_desc *imageDesc, const void *hostPtr) { - auto pDevice = context->getDevice(0); + auto pClDevice = context->getDevice(0); size_t srcSize = 0; size_t retSize = 0; const size_t *maxWidth = nullptr; @@ -456,15 +457,15 @@ cl_int Image::validate(Context *context, Image *parentImage = castToObject(imageDesc->mem_object); Buffer *parentBuffer = castToObject(imageDesc->mem_object); if (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D) { - pDevice->getCap(reinterpret_cast(maxWidth), srcSize, retSize); - pDevice->getCap(reinterpret_cast(maxHeight), srcSize, retSize); + pClDevice->getCap(reinterpret_cast(maxWidth), srcSize, retSize); + pClDevice->getCap(reinterpret_cast(maxHeight), srcSize, retSize); if (imageDesc->image_width > *maxWidth || imageDesc->image_height > *maxHeight) { return CL_INVALID_IMAGE_SIZE; } if (parentBuffer) { // Image 2d from buffer - pDevice->getCap(reinterpret_cast(pitchAlignment), srcSize, retSize); - pDevice->getCap(reinterpret_cast(baseAddressAlignment), srcSize, retSize); + pClDevice->getCap(reinterpret_cast(pitchAlignment), srcSize, retSize); + pClDevice->getCap(reinterpret_cast(baseAddressAlignment), srcSize, retSize); const auto rowSize = imageDesc->image_row_pitch != 0 ? imageDesc->image_row_pitch : alignUp(imageDesc->image_width * surfaceFormat->surfaceFormat.NumChannels * surfaceFormat->surfaceFormat.PerChannelSizeInBytes, *pitchAlignment); const auto minimumBufferSize = imageDesc->image_height * rowSize; @@ -538,7 +539,7 @@ cl_int Image::validatePlanarYUV(Context *context, const cl_image_desc *imageDesc, const void *hostPtr) { cl_int errorCode = CL_SUCCESS; - auto pDevice = context->getDevice(0); + auto pClDevice = context->getDevice(0); const size_t *maxWidth = nullptr; const size_t *maxHeight = nullptr; size_t srcSize = 0; @@ -572,8 +573,8 @@ cl_int Image::validatePlanarYUV(Context *context, } } - pDevice->getCap(reinterpret_cast(maxWidth), srcSize, retSize); - pDevice->getCap(reinterpret_cast(maxHeight), srcSize, retSize); + pClDevice->getCap(reinterpret_cast(maxWidth), srcSize, retSize); + pClDevice->getCap(reinterpret_cast(maxHeight), srcSize, retSize); if (imageDesc->image_width > *maxWidth || imageDesc->image_height > *maxHeight) { errorCode = CL_INVALID_IMAGE_SIZE; break; diff --git a/runtime/os_interface/linux/device_factory_linux.cpp b/runtime/os_interface/linux/device_factory_linux.cpp index 88fbb04044..835377a069 100644 --- a/runtime/os_interface/linux/device_factory_linux.cpp +++ b/runtime/os_interface/linux/device_factory_linux.cpp @@ -64,6 +64,6 @@ void DeviceFactory::releaseDevices() { DeviceFactory::numDevices = 0; } -void Device::appendOSExtensions(std::string &deviceExtensions) { +void ClDevice::initializeCaps() { } } // namespace NEO diff --git a/runtime/os_interface/windows/api_win.cpp b/runtime/os_interface/windows/api_win.cpp index 52fc03a8a6..911370b352 100644 --- a/runtime/os_interface/windows/api_win.cpp +++ b/runtime/os_interface/windows/api_win.cpp @@ -95,7 +95,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromDX9INTEL(cl_platform_id platform, cl_dx9_de if (retVal != CL_SUCCESS) { return retVal; } - cl_device_id device = platformInternal->getDevice(0); + cl_device_id device = platformInternal->getClDevice(0); GetInfoHelper::set(devices, device); GetInfoHelper::set(numDevices, 1u); @@ -202,7 +202,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR(cl_platform_id platform, if (retVal != CL_SUCCESS) { return retVal; } - cl_device_id device = platformInternal->getDevice(0); + cl_device_id device = platformInternal->getClDevice(0); GetInfoHelper::set(devices, device); GetInfoHelper::set(numDevices, 1u); @@ -311,7 +311,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR(cl_platform_id platform, cl_d3d10_ sharingFcns.getDxgiDescFcn = (D3DSharingFunctions::GetDxgiDescFcn)DebugManager.injectFcn; } - Device *device = platformInternal->getDevice(0); + ClDevice *device = platformInternal->getClDevice(0); switch (d3dDeviceSource) { case CL_D3D10_DEVICE_KHR: @@ -518,7 +518,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR(cl_platform_id platform, cl_d3d11_ sharingFcns.getDxgiDescFcn = (D3DSharingFunctions::GetDxgiDescFcn)DebugManager.injectFcn; } - Device *device = platformInternal->getDevice(0); + ClDevice *device = platformInternal->getClDevice(0); switch (d3dDeviceSource) { case CL_D3D11_DEVICE_KHR: diff --git a/runtime/os_interface/windows/device_factory_win.cpp b/runtime/os_interface/windows/device_factory_win.cpp index 672c543b82..df6b7cdca7 100644 --- a/runtime/os_interface/windows/device_factory_win.cpp +++ b/runtime/os_interface/windows/device_factory_win.cpp @@ -53,8 +53,8 @@ void DeviceFactory::releaseDevices() { DeviceFactory::numDevices = 0; } -void Device::appendOSExtensions(std::string &deviceExtensions) { - deviceExtensions += "cl_intel_simultaneous_sharing "; +void ClDevice::initializeCaps() { + device.appendOSExtensions("cl_intel_simultaneous_sharing "); simultaneousInterops = {CL_GL_CONTEXT_KHR, CL_WGL_HDC_KHR, @@ -68,6 +68,7 @@ void Device::appendOSExtensions(std::string &deviceExtensions) { CL_CONTEXT_D3D11_DEVICE_KHR, 0}; } + } // namespace NEO #endif diff --git a/runtime/platform/platform.cpp b/runtime/platform/platform.cpp index 5ce8972064..84e87ad521 100644 --- a/runtime/platform/platform.cpp +++ b/runtime/platform/platform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -50,7 +50,8 @@ Platform *constructPlatform() { } Platform::Platform() { - devices.reserve(4); + clDevices.reserve(4); + clDeviceMap.reserve(20); setAsyncEventsHandler(std::unique_ptr(new AsyncEventsHandler())); executionEnvironment = new ExecutionEnvironment; executionEnvironment->incRefInternal(); @@ -58,9 +59,9 @@ Platform::Platform() { Platform::~Platform() { asyncEventsHandler->closeThread(); - for (auto dev : this->devices) { - if (dev) { - dev->decRefInternal(); + for (auto clDevice : this->clDevices) { + if (clDevice) { + clDevice->decRefInternal(); } } @@ -79,7 +80,7 @@ cl_int Platform::getInfo(cl_platform_info paramName, switch (paramName) { case CL_PLATFORM_HOST_TIMER_RESOLUTION: - pVal = static_cast(this->devices[0]->getPlatformHostTimerResolution()); + pVal = static_cast(this->clDevices[0]->getPlatformHostTimerResolution()); paramSize = sizeof(uint64_t); retVal = ::getInfo(paramValue, paramValueSize, &pVal, paramSize); break; @@ -152,12 +153,18 @@ bool Platform::initialize() { DEBUG_BREAK_IF(this->platformInfo); this->platformInfo.reset(new PlatformInfo); - this->devices.resize(numDevicesReturned); + this->clDevices.resize(numDevicesReturned); for (uint32_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) { auto pDevice = createRootDevice(deviceOrdinal); DEBUG_BREAK_IF(!pDevice); + ClDevice *pClDevice = nullptr; if (pDevice) { - this->devices[deviceOrdinal] = pDevice; + pClDevice = new ClDevice{*pDevice}; + } + DEBUG_BREAK_IF(!pClDevice); + if (pClDevice) { + this->clDevices[deviceOrdinal] = pClDevice; + this->clDeviceMap.emplace(pDevice, pClDevice); this->platformInfo->extensions = pDevice->getDeviceInfo().deviceExtensions; @@ -182,19 +189,19 @@ bool Platform::initialize() { auto hwInfo = executionEnvironment->getHardwareInfo(); const bool sourceLevelDebuggerActive = executionEnvironment->sourceLevelDebugger && executionEnvironment->sourceLevelDebugger->isDebuggerActive(); - if (devices[0]->getPreemptionMode() == PreemptionMode::MidThread || sourceLevelDebuggerActive) { - auto sipType = SipKernel::getSipKernelType(hwInfo->platform.eRenderCoreFamily, devices[0]->isSourceLevelDebuggerActive()); - initSipKernel(sipType, *devices[0]); + if (clDevices[0]->getPreemptionMode() == PreemptionMode::MidThread || sourceLevelDebuggerActive) { + auto sipType = SipKernel::getSipKernelType(hwInfo->platform.eRenderCoreFamily, clDevices[0]->isSourceLevelDebuggerActive()); + initSipKernel(sipType, *clDevices[0]); } - CommandStreamReceiverType csrType = this->devices[0]->getDefaultEngine().commandStreamReceiver->getType(); + CommandStreamReceiverType csrType = this->clDevices[0]->getDefaultEngine().commandStreamReceiver->getType(); if (csrType != CommandStreamReceiverType::CSR_HW) { auto enableLocalMemory = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo); executionEnvironment->rootDeviceEnvironments[0]->initAubCenter(enableLocalMemory, "aubfile", csrType); } this->fillGlobalDispatchTable(); - DEBUG_BREAK_IF(DebugManager.flags.CreateMultipleRootDevices.get() > 1 && !this->devices[0]->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled()); + DEBUG_BREAK_IF(DebugManager.flags.CreateMultipleRootDevices.get() > 1 && !this->clDevices[0]->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled()); state = StateInited; return true; } @@ -212,16 +219,29 @@ bool Platform::isInitialized() { Device *Platform::getDevice(size_t deviceOrdinal) { TakeOwnershipWrapper platformOwnership(*this); - if (this->state != StateInited || deviceOrdinal >= devices.size()) { + if (this->state != StateInited || deviceOrdinal >= clDevices.size()) { return nullptr; } - auto pDevice = devices[deviceOrdinal]; + auto pDevice = &clDevices[deviceOrdinal]->getDevice(); DEBUG_BREAK_IF(pDevice == nullptr); return pDevice; } +ClDevice *Platform::getClDevice(size_t deviceOrdinal) { + TakeOwnershipWrapper platformOwnership(*this); + + if (this->state != StateInited || deviceOrdinal >= clDevices.size()) { + return nullptr; + } + + auto pClDevice = clDevices[deviceOrdinal]; + DEBUG_BREAK_IF(pClDevice == nullptr); + + return pClDevice; +} + size_t Platform::getNumDevices() const { TakeOwnershipWrapper platformOwnership(*this); @@ -229,17 +249,17 @@ size_t Platform::getNumDevices() const { return 0; } - return devices.size(); + return clDevices.size(); } -Device **Platform::getDevices() { +ClDevice **Platform::getClDevices() { TakeOwnershipWrapper platformOwnership(*this); if (this->state != StateInited) { return nullptr; } - return devices.data(); + return clDevices.data(); } const PlatformInfo &Platform::getPlatformInfo() const { diff --git a/runtime/platform/platform.h b/runtime/platform/platform.h index 36286f51e3..bbd9077965 100644 --- a/runtime/platform/platform.h +++ b/runtime/platform/platform.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -13,6 +13,7 @@ #include "platform_info.h" #include +#include #include namespace NEO { @@ -52,8 +53,10 @@ class Platform : public BaseObject<_cl_platform_id> { bool isInitialized(); size_t getNumDevices() const; - Device **getDevices(); Device *getDevice(size_t deviceOrdinal); + ClDevice **getClDevices(); + ClDevice *getClDevice(size_t deviceOrdinal); + std::unordered_map clDeviceMap; const PlatformInfo &getPlatformInfo() const; AsyncEventsHandler *getAsyncEventsHandler(); @@ -73,7 +76,7 @@ class Platform : public BaseObject<_cl_platform_id> { MOCKABLE_VIRTUAL void initializationLoopHelper(){}; MOCKABLE_VIRTUAL RootDevice *createRootDevice(uint32_t rootDeviceIndex) const; std::unique_ptr platformInfo; - DeviceVector devices; + ClDeviceVector clDevices; std::string compilerExtensions; std::unique_ptr asyncEventsHandler; ExecutionEnvironment *executionEnvironment = nullptr; diff --git a/runtime/program/build.cpp b/runtime/program/build.cpp index 7b6c64e91a..2f49b3c0eb 100644 --- a/runtime/program/build.cpp +++ b/runtime/program/build.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -111,7 +111,7 @@ cl_int Program::build( "\nBuild Internal Options", inputArgs.internalOptions.begin()); inputArgs.allowCaching = enableCaching; NEO::TranslationOutput compilerOuput = {}; - auto compilerErr = pCompilerInterface->build(*this->pDevice, inputArgs, compilerOuput); + auto compilerErr = pCompilerInterface->build(this->pDevice->getDevice(), inputArgs, compilerOuput); this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size()); this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size()); retVal = asClError(compilerErr); @@ -183,9 +183,10 @@ void Program::notifyDebuggerWithSourceCode(std::string &filename) { } } -cl_int Program::build(const cl_device_id device, const char *buildOptions, bool enableCaching, +cl_int Program::build(const Device *pDevice, const char *buildOptions, bool enableCaching, std::unordered_map &builtinsMap) { - auto ret = this->build(1, &device, buildOptions, nullptr, nullptr, enableCaching); + cl_device_id deviceId = platform()->clDeviceMap[pDevice]; + auto ret = this->build(1, &deviceId, buildOptions, nullptr, nullptr, enableCaching); if (ret != CL_SUCCESS) { return ret; } diff --git a/runtime/program/compile.cpp b/runtime/program/compile.cpp index 7a2ef3ec79..c3c9db2b8e 100644 --- a/runtime/program/compile.cpp +++ b/runtime/program/compile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -154,7 +154,7 @@ cl_int Program::compile( inputArgs.internalOptions = ArrayRef(internalOptions.c_str(), internalOptions.length()); TranslationOutput compilerOuput; - auto compilerErr = pCompilerInterface->compile(*this->pDevice, inputArgs, compilerOuput); + auto compilerErr = pCompilerInterface->compile(this->pDevice->getDevice(), inputArgs, compilerOuput); this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size()); this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size()); retVal = asClError(compilerErr); diff --git a/runtime/program/create.cpp b/runtime/program/create.cpp index fd7c45e1a2..fe5ef00e27 100644 --- a/runtime/program/create.cpp +++ b/runtime/program/create.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,6 +12,7 @@ namespace NEO { template Program *Program::create(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int &); template Program *Program::create(cl_context, cl_uint, const char **, const size_t *, cl_int &); +template Program *Program::create(const char *, Context *, ClDevice &, bool, cl_int *); template Program *Program::create(const char *, Context *, Device &, bool, cl_int *); template Program *Program::createFromIL(Context *, const void *, size_t length, cl_int &); template Program *Program::createFromGenBinary(ExecutionEnvironment &executionEnvironment, Context *context, const void *binary, size_t size, bool isBuiltIn, cl_int *errcodeRet); diff --git a/runtime/program/create.inl b/runtime/program/create.inl index c32a650689..86f06745e8 100644 --- a/runtime/program/create.inl +++ b/runtime/program/create.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "runtime/context/context.h" #include "runtime/device/device.h" #include "runtime/helpers/string_helpers.h" +#include "runtime/platform/platform.h" #include "runtime/program/program.h" #include "compiler_options.h" @@ -81,7 +82,7 @@ template T *Program::create( const char *nullTerminatedString, Context *context, - Device &device, + ClDevice &device, bool isBuiltIn, cl_int *errcodeRet) { cl_int retVal = CL_SUCCESS; @@ -113,6 +114,16 @@ T *Program::create( return program; } +template +T *Program::create( + const char *nullTerminatedString, + Context *context, + Device &device, + bool isBuiltIn, + cl_int *errcodeRet) { + return Program::create(nullTerminatedString, context, *platform()->clDeviceMap[&device], isBuiltIn, errcodeRet); +} + template T *Program::createFromGenBinary( ExecutionEnvironment &executionEnvironment, diff --git a/runtime/program/get_info.cpp b/runtime/program/get_info.cpp index b4c45a30f0..d5cc1818ac 100644 --- a/runtime/program/get_info.cpp +++ b/runtime/program/get_info.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -166,7 +166,7 @@ cl_int Program::getBuildInfo(cl_device_id device, cl_program_build_info paramNam return CL_INVALID_DEVICE; } - auto pDev = castToObject(device); + auto pClDev = castToObject(device); switch (paramName) { case CL_PROGRAM_BUILD_STATUS: @@ -180,7 +180,7 @@ cl_int Program::getBuildInfo(cl_device_id device, cl_program_build_info paramNam break; case CL_PROGRAM_BUILD_LOG: { - const char *pBuildLog = getBuildLog(pDev); + const char *pBuildLog = getBuildLog(pClDev); if (pBuildLog != nullptr) { pSrc = pBuildLog; diff --git a/runtime/program/link.cpp b/runtime/program/link.cpp index 91b019eceb..7459f2363f 100644 --- a/runtime/program/link.cpp +++ b/runtime/program/link.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -118,7 +118,7 @@ cl_int Program::link( if (!isCreateLibrary) { inputArgs.outType = IGC::CodeType::oclGenBin; NEO::TranslationOutput compilerOuput = {}; - auto compilerErr = pCompilerInterface->link(*this->pDevice, inputArgs, compilerOuput); + auto compilerErr = pCompilerInterface->link(this->pDevice->getDevice(), inputArgs, compilerOuput); this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size()); this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size()); retVal = asClError(compilerErr); @@ -146,7 +146,7 @@ cl_int Program::link( } else { inputArgs.outType = IGC::CodeType::llvmBc; NEO::TranslationOutput compilerOuput = {}; - auto compilerErr = pCompilerInterface->createLibrary(*this->pDevice, inputArgs, compilerOuput); + auto compilerErr = pCompilerInterface->createLibrary(this->pDevice->getDevice(), inputArgs, compilerOuput); this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size()); this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size()); retVal = asClError(compilerErr); diff --git a/runtime/program/printf_handler.cpp b/runtime/program/printf_handler.cpp index e8677117f4..e37fa234b7 100644 --- a/runtime/program/printf_handler.cpp +++ b/runtime/program/printf_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,13 +18,13 @@ namespace NEO { -PrintfHandler::PrintfHandler(Device &deviceArg) : device(deviceArg) {} +PrintfHandler::PrintfHandler(ClDevice &deviceArg) : device(deviceArg) {} PrintfHandler::~PrintfHandler() { device.getMemoryManager()->freeGraphicsMemory(printfSurface); } -PrintfHandler *PrintfHandler::create(const MultiDispatchInfo &multiDispatchInfo, Device &device) { +PrintfHandler *PrintfHandler::create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &device) { if (multiDispatchInfo.usesStatelessPrintfSurface()) { return new PrintfHandler(device); } diff --git a/runtime/program/printf_handler.h b/runtime/program/printf_handler.h index 224f702512..7a944d9094 100644 --- a/runtime/program/printf_handler.h +++ b/runtime/program/printf_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,11 +12,12 @@ namespace NEO { +class ClDevice; struct MultiDispatchInfo; class PrintfHandler { public: - static PrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, Device &deviceArg); + static PrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &deviceArg); ~PrintfHandler(); @@ -29,10 +30,10 @@ class PrintfHandler { } protected: - PrintfHandler(Device &device); + PrintfHandler(ClDevice &device); static const uint32_t printfSurfaceInitialDataSize = sizeof(uint32_t); - Device &device; + ClDevice &device; Kernel *kernel = nullptr; GraphicsAllocation *printfSurface = nullptr; }; diff --git a/runtime/program/process_gen_binary.cpp b/runtime/program/process_gen_binary.cpp index 50ae056d58..dc13663784 100644 --- a/runtime/program/process_gen_binary.cpp +++ b/runtime/program/process_gen_binary.cpp @@ -141,7 +141,7 @@ inline uint64_t readMisalignedUint64(const uint64_t *address) { return static_cast(static_cast(addressBits[1]) << 32) | addressBits[0]; } -GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::Device *device, size_t size, bool constant, bool globalsAreExported, const void *initData) { +GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::ClDevice *device, size_t size, bool constant, bool globalsAreExported, const void *initData) { UNRECOVERABLE_IF(device == nullptr); if (globalsAreExported && (ctx != nullptr) && (ctx->getSVMAllocsManager() != nullptr)) { NEO::SVMAllocsManager::SvmAllocationProperties svmProps = {}; diff --git a/runtime/program/program.cpp b/runtime/program/program.cpp index 1b815d7054..2bbd212dcf 100644 --- a/runtime/program/program.cpp +++ b/runtime/program/program.cpp @@ -18,6 +18,7 @@ #include "runtime/context/context.h" #include "runtime/device/device.h" #include "runtime/memory_manager/memory_manager.h" +#include "runtime/platform/platform.h" #include "runtime/program/block_kernel_manager.h" #include "runtime/program/kernel_info.h" @@ -204,7 +205,7 @@ cl_int Program::rebuildProgramFromIr() { inputArgs.internalOptions = ArrayRef(internalOptions); TranslationOutput compilerOuput = {}; - auto err = pCompilerInterface->link(*this->pDevice, inputArgs, compilerOuput); + auto err = pCompilerInterface->link(this->pDevice->getDevice(), inputArgs, compilerOuput); this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size()); this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size()); if (TranslationOutput::ErrorCode::Success != err) { @@ -243,7 +244,7 @@ cl_int Program::setProgramSpecializationConstant(cl_uint specId, size_t specSize } SpecConstantInfo specConstInfo; - auto retVal = pCompilerInterface->getSpecConstantsInfo(this->getDevice(0), ArrayRef(sourceCode), specConstInfo); + auto retVal = pCompilerInterface->getSpecConstantsInfo(this->getDevice(0).getDevice(), ArrayRef(sourceCode), specConstInfo); if (retVal != TranslationOutput::ErrorCode::Success) { return CL_INVALID_VALUE; @@ -285,6 +286,10 @@ bool Program::isValidLlvmBinary( return retVal; } +void Program::setDevice(Device *device) { + this->pDevice = platform()->clDeviceMap[device]; +} + cl_int Program::getSource(std::string &binary) const { cl_int retVal = CL_INVALID_PROGRAM; binary = {}; @@ -295,7 +300,7 @@ cl_int Program::getSource(std::string &binary) const { return retVal; } -void Program::updateBuildLog(const Device *pDevice, const char *pErrorString, +void Program::updateBuildLog(const ClDevice *pDevice, const char *pErrorString, size_t errorStringSize) { if ((pErrorString == nullptr) || (errorStringSize == 0) || (pErrorString[0] == '\0')) { return; @@ -316,7 +321,7 @@ void Program::updateBuildLog(const Device *pDevice, const char *pErrorString, buildLog[pDevice].append(pErrorString, pErrorString + errorStringSize); } -const char *Program::getBuildLog(const Device *pDevice) const { +const char *Program::getBuildLog(const ClDevice *pDevice) const { const char *entry = nullptr; auto it = buildLog.find(pDevice); diff --git a/runtime/program/program.h b/runtime/program/program.h index c67ce5a5a9..76a5ae794a 100644 --- a/runtime/program/program.h +++ b/runtime/program/program.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,8 +27,10 @@ struct ProgramFromPatchtokens; class BlockKernelManager; class BuiltinDispatchInfoBuilder; +class ClDevice; class Context; class CompilerInterface; +class Device; class ExecutionEnvironment; struct KernelInfo; template <> @@ -84,6 +86,14 @@ class Program : public BaseObject<_cl_program> { const size_t *lengths, cl_int &errcodeRet); + template + static T *create( + const char *nullTerminatedString, + Context *context, + ClDevice &device, + bool isBuiltIn, + cl_int *errcodeRet); + template static T *create( const char *nullTerminatedString, @@ -117,7 +127,7 @@ class Program : public BaseObject<_cl_program> { void(CL_CALLBACK *funcNotify)(cl_program program, void *userData), void *userData, bool enableCaching); - cl_int build(const cl_device_id device, const char *buildOptions, bool enableCaching, + cl_int build(const Device *pDevice, const char *buildOptions, bool enableCaching, std::unordered_map &builtinsMap); MOCKABLE_VIRTUAL cl_int processGenBinary(); @@ -161,12 +171,12 @@ class Program : public BaseObject<_cl_program> { return executionEnvironment; } - const Device &getDevice(cl_uint deviceOrdinal) const { + const ClDevice &getDevice(cl_uint deviceOrdinal) const { UNRECOVERABLE_IF(pDevice == nullptr); return *pDevice; } - void setDevice(Device *device) { this->pDevice = device; } + void setDevice(Device *device); MOCKABLE_VIRTUAL cl_int processElfBinary(const void *pBinary, size_t binarySize, uint32_t &binaryVersion); cl_int processSpirBinary(const void *pBinary, size_t binarySize, bool isSpirV); @@ -175,9 +185,9 @@ class Program : public BaseObject<_cl_program> { void processDebugData(); - void updateBuildLog(const Device *pDevice, const char *pErrorString, const size_t errorStringSize); + void updateBuildLog(const ClDevice *pDevice, const char *pErrorString, const size_t errorStringSize); - const char *getBuildLog(const Device *pDevice) const; + const char *getBuildLog(const ClDevice *pDevice) const; cl_uint getProgramBinaryType() const { return programBinaryType; @@ -327,7 +337,7 @@ class Program : public BaseObject<_cl_program> { std::unique_ptr linkerInput; Linker::RelocatedSymbolsMap symbols; - std::map buildLog; + std::map buildLog; bool areSpecializationConstantsInitialized = false; CIF::RAII::UPtr_t specConstantsIds; @@ -337,13 +347,13 @@ class Program : public BaseObject<_cl_program> { BlockKernelManager *blockKernelManager; ExecutionEnvironment &executionEnvironment; Context *context; - Device *pDevice; + ClDevice *pDevice; cl_uint numDevices; bool isBuiltIn; bool kernelDebugEnabled = false; }; -GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::Device *device, size_t size, bool constant, bool globalsAreExported, const void *initData); +GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::ClDevice *device, size_t size, bool constant, bool globalsAreExported, const void *initData); } // namespace NEO diff --git a/runtime/scheduler/scheduler_kernel.h b/runtime/scheduler/scheduler_kernel.h index 95b6626375..26290192e2 100644 --- a/runtime/scheduler/scheduler_kernel.h +++ b/runtime/scheduler/scheduler_kernel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -52,7 +52,7 @@ class SchedulerKernel : public Kernel { GraphicsAllocation *debugQueue = nullptr); protected: - SchedulerKernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg, true), gws(0) { + SchedulerKernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg, true), gws(0) { computeGws(); }; diff --git a/runtime/sharings/gl/cl_gl_api.cpp b/runtime/sharings/gl/cl_gl_api.cpp index ab03e021f2..364a161980 100644 --- a/runtime/sharings/gl/cl_gl_api.cpp +++ b/runtime/sharings/gl/cl_gl_api.cpp @@ -345,7 +345,7 @@ cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties *properties } if (paramName == CL_DEVICES_FOR_GL_CONTEXT_KHR || paramName == CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR) { - info.set(::platform()->getDevice(0)); + info.set(::platform()->getClDevice(0)); return retVal; } diff --git a/runtime/sharings/va/cl_va_api.cpp b/runtime/sharings/va/cl_va_api.cpp index a706464687..20c2a421a6 100644 --- a/runtime/sharings/va/cl_va_api.cpp +++ b/runtime/sharings/va/cl_va_api.cpp @@ -70,7 +70,7 @@ clGetDeviceIDsFromVA_APIMediaAdapterINTEL(cl_platform_id platform, cl_va_api_dev if (status != CL_SUCCESS) { status = CL_INVALID_PLATFORM; } else { - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); GetInfoHelper::set(devices, device); GetInfoHelper::set(numDevices, 1u); } diff --git a/unit_tests/accelerators/media_image_arg_tests.cpp b/unit_tests/accelerators/media_image_arg_tests.cpp index caa75863dc..b09394a0d0 100644 --- a/unit_tests/accelerators/media_image_arg_tests.cpp +++ b/unit_tests/accelerators/media_image_arg_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -51,7 +51,7 @@ class MediaImageSetArgTest : public DeviceFixture, pKernelInfo->kernelArgInfo[1].isImage = true; pKernelInfo->kernelArgInfo[0].isImage = true; - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_NE(nullptr, pKernel); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); @@ -59,7 +59,7 @@ class MediaImageSetArgTest : public DeviceFixture, pKernel->setKernelArgHandler(0, &Kernel::setArgImage); pKernel->setKernelArgHandler(1, &Kernel::setArgImage); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); srcImage = Image2dHelper<>::create(context); ASSERT_NE(nullptr, srcImage); } diff --git a/unit_tests/api/cl_add_comment_to_aub_tests.inl b/unit_tests/api/cl_add_comment_to_aub_tests.inl index 4a2f27fc1d..13b467b256 100644 --- a/unit_tests/api/cl_add_comment_to_aub_tests.inl +++ b/unit_tests/api/cl_add_comment_to_aub_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,7 @@ struct clAddCommentToAubTest : api_tests { api_tests::TearDown(); } - Device *pDevice = nullptr; + ClDevice *pDevice = nullptr; }; TEST_F(clAddCommentToAubTest, givenProperCommentNullptrAubCenterWhenAddCommentToAubThenSuccessIsReturned) { diff --git a/unit_tests/api/cl_api_tests.cpp b/unit_tests/api/cl_api_tests.cpp index a00a390ce6..e1cb4c7674 100644 --- a/unit_tests/api/cl_api_tests.cpp +++ b/unit_tests/api/cl_api_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,11 +25,11 @@ void ApiFixture::SetUp() { EXPECT_LT(0u, testedRootDeviceIndex); rootDeviceEnvironmentBackup.swap(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]); - auto pDevice = pPlatform->getDevice(testedRootDeviceIndex); + auto pDevice = pPlatform->getClDevice(testedRootDeviceIndex); ASSERT_NE(nullptr, pDevice); testedClDevice = pDevice; - pContext = Context::create(nullptr, DeviceVector(&testedClDevice, 1), nullptr, nullptr, retVal); + pContext = Context::create(nullptr, ClDeviceVector(&testedClDevice, 1), nullptr, nullptr, retVal); EXPECT_EQ(retVal, CL_SUCCESS); pCommandQueue = new CommandQueue(pContext, pDevice, nullptr); @@ -53,20 +53,19 @@ void api_fixture_using_aligned_memory_manager::SetUp() { retVal = CL_SUCCESS; retSize = 0; - device = MockDevice::createWithNewExecutionEnvironment(*platformDevices); - Device *devPtr = reinterpret_cast(device); - cl_device_id clDevice = devPtr; + device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(*platformDevices)}; + cl_device_id deviceId = device; - context = Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal); + context = Context::create(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); Context *ctxPtr = reinterpret_cast(context); - commandQueue = new CommandQueue(context, devPtr, 0); + commandQueue = new CommandQueue(context, device, 0); program = new MockProgram(*device->getExecutionEnvironment(), ctxPtr, false); Program *prgPtr = reinterpret_cast(program); - kernel = new MockKernel(prgPtr, program->mockKernelInfo, *devPtr); + kernel = new MockKernel(prgPtr, program->mockKernelInfo, *device); ASSERT_NE(nullptr, kernel); } diff --git a/unit_tests/api/cl_api_tests.h b/unit_tests/api/cl_api_tests.h index d6081ca28e..f304743a44 100644 --- a/unit_tests/api/cl_api_tests.h +++ b/unit_tests/api/cl_api_tests.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,9 +21,9 @@ namespace NEO { class CommandQueue; class Context; +class MockClDevice; class MockKernel; class MockProgram; -class MockAlignedMallocManagerDevice; struct RootDeviceEnvironment; extern size_t numPlatformDevices; @@ -70,7 +70,7 @@ struct api_fixture_using_aligned_memory_manager { Context *context; MockKernel *kernel; MockProgram *program; - MockAlignedMallocManagerDevice *device; + MockClDevice *device; }; using api_test_using_aligned_memory_manager = Test; diff --git a/unit_tests/api/cl_create_command_queue_tests.inl b/unit_tests/api/cl_create_command_queue_tests.inl index a6baabe4e7..433d155eb6 100644 --- a/unit_tests/api/cl_create_command_queue_tests.inl +++ b/unit_tests/api/cl_create_command_queue_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -64,7 +64,8 @@ TEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenQueueIs HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToBatchingMode) { cl_int retVal = CL_SUCCESS; cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; - auto mockDevice = castToObject(devices[testedRootDeviceIndex]); + auto clDevice = castToObject(devices[testedRootDeviceIndex]); + auto mockDevice = reinterpret_cast(&clDevice->getDevice()); auto &csr = mockDevice->getUltCommandStreamReceiver(); EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode); @@ -76,7 +77,8 @@ HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenComma HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToNTo1SubmissionModel) { cl_int retVal = CL_SUCCESS; cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; - auto mockDevice = castToObject(devices[testedRootDeviceIndex]); + auto clDevice = castToObject(devices[testedRootDeviceIndex]); + auto mockDevice = reinterpret_cast(&clDevice->getDevice()); auto &csr = mockDevice->getUltCommandStreamReceiver(); EXPECT_FALSE(csr.isNTo1SubmissionModelEnabled()); diff --git a/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp b/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp index fe5694a1ad..a06d404125 100644 --- a/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp +++ b/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp @@ -79,7 +79,7 @@ TEST_P(clCreateCommandQueueWithPropertiesTests, GivenPropertiesWhenCreatingComma const auto minimumCreateDeviceQueueFlags = static_cast(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); const auto deviceQueueShouldBeCreated = (commandQueueProperties & minimumCreateDeviceQueueFlags) == minimumCreateDeviceQueueFlags; - if (deviceQueueShouldBeCreated && !castToObject(this->devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { + if (deviceQueueShouldBeCreated && !castToObject(this->devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { return; } @@ -267,7 +267,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOf GTEST_SKIP(); } cl_int retVal = CL_SUCCESS; - auto pDevice = castToObject(devices[testedRootDeviceIndex]); + auto pDevice = castToObject(devices[testedRootDeviceIndex]); cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0, 0}; auto cmdq1 = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], odq, &retVal); diff --git a/unit_tests/api/cl_create_image_tests.cpp b/unit_tests/api/cl_create_image_tests.cpp index 41af844ecc..77e01830ec 100644 --- a/unit_tests/api/cl_create_image_tests.cpp +++ b/unit_tests/api/cl_create_image_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -66,7 +66,7 @@ TEST_F(clCreateImageTest, GivenNullHostPtrWhenCreatingImageThenImageIsCreatedAnd } HWTEST_F(clCreateImageTest, GivenDeviceThatDoesntSupportImagesWhenCreatingTiledImageThenInvalidOperationErrorIsReturned) { - auto device = static_cast(pContext->getDevice(0)); + auto device = static_cast(&pContext->getDevice(0)->getDevice()); device->deviceInfo.imageSupport = CL_FALSE; cl_bool imageSupportInfo = CL_TRUE; auto status = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_IMAGE_SUPPORT, sizeof(imageSupportInfo), &imageSupportInfo, nullptr); @@ -93,7 +93,7 @@ HWTEST_F(clCreateImageTest, GivenDeviceThatDoesntSupportImagesWhenCreatingTiledI } HWTEST_F(clCreateImageTest, GivenDeviceThatDoesntSupportImagesWhenCreatingNonTiledImageThenCreate) { - auto device = static_cast(pContext->getDevice(0)); + auto device = static_cast(&pContext->getDevice(0)->getDevice()); device->deviceInfo.imageSupport = CL_FALSE; cl_bool imageSupportInfo = CL_TRUE; auto status = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_IMAGE_SUPPORT, sizeof(imageSupportInfo), &imageSupportInfo, nullptr); diff --git a/unit_tests/api/cl_create_perf_counters_command_queue_tests.inl b/unit_tests/api/cl_create_perf_counters_command_queue_tests.inl index 223171a723..3b519ab3a6 100644 --- a/unit_tests/api/cl_create_perf_counters_command_queue_tests.inl +++ b/unit_tests/api/cl_create_perf_counters_command_queue_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,9 +23,9 @@ struct clCreatePerfCountersCommandQueueINTELTests : public DeviceInstrumentation PerformanceCountersDeviceFixture::SetUp(); DeviceInstrumentationFixture::SetUp(true); - clDevice = device.get(); + deviceId = device.get(); retVal = CL_SUCCESS; - context = std::unique_ptr(Context::create(nullptr, DeviceVector(&clDevice, 1), + context = std::unique_ptr(Context::create(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal)); } void TearDown() override { @@ -33,7 +33,7 @@ struct clCreatePerfCountersCommandQueueINTELTests : public DeviceInstrumentation } std::unique_ptr context; - cl_device_id clDevice; + cl_device_id deviceId; cl_int retVal; }; @@ -44,7 +44,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectParamatersWhenCre cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE; cl_uint configuration = 0; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); ASSERT_NE(nullptr, cmdQ); ASSERT_EQ(CL_SUCCESS, retVal); @@ -60,7 +60,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenNullPropertiesWhenCreati cl_queue_properties properties = 0; cl_uint configuration = 0; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); ASSERT_EQ(nullptr, cmdQ); ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal); @@ -71,12 +71,12 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenClQueueOnDevicePropertyW cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE; cl_uint configuration = 0; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); ASSERT_EQ(nullptr, cmdQ); ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal); properties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE_DEFAULT; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); ASSERT_EQ(nullptr, cmdQ); ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal); @@ -87,7 +87,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenNullContextWhenCreatingP cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE; cl_uint configuration = 0; - cmdQ = clCreatePerfCountersCommandQueueINTEL(nullptr, clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(nullptr, deviceId, properties, configuration, &retVal); ASSERT_EQ(nullptr, cmdQ); ASSERT_EQ(CL_INVALID_CONTEXT, retVal); @@ -98,7 +98,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenMaximumGtdiConfiguration cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE; cl_uint configuration = 4; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); ASSERT_EQ(nullptr, cmdQ); ASSERT_EQ(CL_INVALID_OPERATION, retVal); @@ -109,7 +109,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectCmdQWhenEventIsCr cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE; cl_uint configuration = 0; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); ASSERT_NE(nullptr, cmdQ); ASSERT_EQ(CL_SUCCESS, retVal); @@ -129,7 +129,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInstrumentationEnabledIs cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE; cl_uint configuration = 0; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); ASSERT_EQ(nullptr, cmdQ); EXPECT_EQ(CL_INVALID_DEVICE, retVal); } @@ -150,7 +150,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInvalidMetricsLibraryWhe cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE; cl_uint configuration = 0; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); auto commandQueueObject = castToObject(cmdQ); ASSERT_NE(nullptr, cmdQ); ASSERT_EQ(CL_SUCCESS, retVal); @@ -174,7 +174,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, givenInvalidMetricsLibraryWhe auto metricsLibary = static_cast(performanceCounters->getMetricsLibraryInterface()); metricsLibary->validOpen = false; - cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal); + cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal); EXPECT_EQ(nullptr, cmdQ); EXPECT_EQ(CL_OUT_OF_RESOURCES, retVal); } diff --git a/unit_tests/api/cl_create_pipe_tests.inl b/unit_tests/api/cl_create_pipe_tests.inl index 5cab9e4e91..73325fb7e2 100644 --- a/unit_tests/api/cl_create_pipe_tests.inl +++ b/unit_tests/api/cl_create_pipe_tests.inl @@ -167,14 +167,14 @@ TEST(clCreatePipeTest, givenPlatformWithoutDevicesWhenClCreatePipeIsCalledThenDe auto executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment->initializeMemoryManager(); executionEnvironment->prepareRootDeviceEnvironments(1); - auto device = std::unique_ptr(Device::create(executionEnvironment, 0u)); + auto device = std::make_unique(*Device::create(executionEnvironment, 0u)); const DeviceInfo &devInfo = device->getDeviceInfo(); if (devInfo.svmCapabilities == 0) { GTEST_SKIP(); } cl_device_id clDevice = device.get(); cl_int retVal; - auto context = ReleaseableObjectPtr(Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); + auto context = ReleaseableObjectPtr(Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(0u, platform()->getNumDevices()); diff --git a/unit_tests/api/cl_create_program_with_built_in_kernels_tests.cpp b/unit_tests/api/cl_create_program_with_built_in_kernels_tests.cpp index 7ba8ab9261..fb4aefbc45 100644 --- a/unit_tests/api/cl_create_program_with_built_in_kernels_tests.cpp +++ b/unit_tests/api/cl_create_program_with_built_in_kernels_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,10 +23,14 @@ typedef api_tests clCreateProgramWithBuiltInKernelsTests; struct clCreateProgramWithBuiltInVmeKernelsTests : clCreateProgramWithBuiltInKernelsTests { void SetUp() override { clCreateProgramWithBuiltInKernelsTests::SetUp(); - if (!castToObject(devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsVme) { + if (!castToObject(devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsVme) { GTEST_SKIP(); } + + pDev = &pContext->getDevice(0)->getDevice(); } + + Device *pDev; }; namespace ULT { @@ -80,7 +84,6 @@ TEST_F(clCreateProgramWithBuiltInKernelsTests, GivenNoKernelsAndNoReturnWhenCrea TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWhenCreatingProgramWithBuiltInKernelsThenProgramIsSuccessfullyCreated) { cl_int retVal = CL_SUCCESS; - auto pDev = pContext->getDevice(0); overwriteBuiltInBinaryName(pDev, "media_kernels_frontend"); const char *kernelNamesString = { @@ -124,7 +127,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWhenCrea TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWithOptionsWhenCreatingProgramWithBuiltInKernelsThenProgramIsSuccessfullyCreatedWithThoseOptions) { cl_int retVal = CL_SUCCESS; - auto pDev = pContext->getDevice(0); overwriteBuiltInBinaryName(pDev, "media_kernels_frontend"); const char *kernelNamesString = { @@ -150,8 +152,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWithOpti TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockMotionEstimateKernelWhenCreatingProgramWithBuiltInKernelsThenCorrectDispatchBuilderAndFrontendKernelIsCreated) { cl_int retVal = CL_SUCCESS; - auto pDev = pContext->getDevice(0); - overwriteBuiltInBinaryName(pDev, "media_kernels_backend"); pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockMotionEstimateIntel, *pContext, *pDev); restoreBuiltInBinaryName(pDev); @@ -179,7 +179,7 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockMotionEstimateKer EXPECT_EQ(6U, kernNeo->getKernelArgsNumber()); auto ctxNeo = castToObject(pContext); - auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockMotionEstimateIntel, *ctxNeo, *ctxNeo->getDevice(0)); + auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockMotionEstimateIntel, *ctxNeo, ctxNeo->getDevice(0)->getDevice()); EXPECT_EQ(&vmeBuilder, kernNeo->getKernelInfo().builtinDispatchBuilder); clReleaseKernel(kernel); @@ -189,8 +189,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockMotionEstimateKer TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEstimateKernelWhenCreatingProgramWithBuiltInKernelsThenCorrectDispatchBuilderAndFrontendKernelIsCreated) { cl_int retVal = CL_SUCCESS; - auto pDev = pContext->getDevice(0); - overwriteBuiltInBinaryName(pDev, "media_kernels_backend"); pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, *pContext, *pDev); restoreBuiltInBinaryName(pDev); @@ -218,7 +216,7 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEst EXPECT_EQ(15U, kernNeo->getKernelArgsNumber()); auto ctxNeo = castToObject(pContext); - auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, *ctxNeo, *ctxNeo->getDevice(0)); + auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, *ctxNeo, ctxNeo->getDevice(0)->getDevice()); EXPECT_EQ(&vmeBuilder, kernNeo->getKernelInfo().builtinDispatchBuilder); clReleaseKernel(kernel); @@ -228,8 +226,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEst TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEstimateBidirectionalCheckKernelWhenCreatingProgramWithBuiltInKernelsThenCorrectDispatchBuilderAndFrontendKernelIsCreated) { cl_int retVal = CL_SUCCESS; - auto pDev = pContext->getDevice(0); - overwriteBuiltInBinaryName(pDev, "media_kernels_backend"); pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, *pContext, *pDev); restoreBuiltInBinaryName(pDev); @@ -257,7 +253,7 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEst EXPECT_EQ(20U, kernNeo->getKernelArgsNumber()); auto ctxNeo = castToObject(pContext); - auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, *ctxNeo, *ctxNeo->getDevice(0)); + auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, *ctxNeo, ctxNeo->getDevice(0)->getDevice()); EXPECT_EQ(&vmeBuilder, kernNeo->getKernelInfo().builtinDispatchBuilder); clReleaseKernel(kernel); diff --git a/unit_tests/api/cl_create_sub_devices_tests.inl b/unit_tests/api/cl_create_sub_devices_tests.inl index 252212725d..b9945a1931 100644 --- a/unit_tests/api/cl_create_sub_devices_tests.inl +++ b/unit_tests/api/cl_create_sub_devices_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ namespace ULT { struct clCreateSubDevicesTests : ::testing::Test { DebugManagerStateRestore restorer; VariableBackup mockDeviceCreateSingleDeviceBackup{&MockDevice::createSingleDevice}; - std::unique_ptr device; + std::unique_ptr device; cl_device_partition_property properties[3] = {CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NUMA, 0}; cl_uint outDevicesCount = 2; cl_device_id outDevices[2]; @@ -27,7 +27,7 @@ struct clCreateSubDevicesTests : ::testing::Test { void setup(int numberOfDevices) { DebugManager.flags.CreateMultipleSubDevices.set(numberOfDevices); mockDeviceCreateSingleDeviceBackup = (numberOfDevices == 1); - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); } }; diff --git a/unit_tests/api/cl_get_device_and_host_timer.inl b/unit_tests/api/cl_get_device_and_host_timer.inl index 31d1a6112c..0549646b05 100644 --- a/unit_tests/api/cl_get_device_and_host_timer.inl +++ b/unit_tests/api/cl_get_device_and_host_timer.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -66,7 +66,7 @@ TEST_F(clGetDeviceAndHostTimerTest, GivenValidOSTimeWhenGettingDeviceAndHostTime cl_ulong host_timestamp = 0; cl_ulong zero_timestamp = 0; - auto mDev = MockDevice::createWithNewExecutionEnvironment(nullptr); + auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; mDev->setOSTime(new MockOSTime()); retVal = clGetDeviceAndHostTimer( @@ -86,7 +86,7 @@ TEST_F(clGetDeviceAndHostTimerTest, GivenInvalidOSTimeWhenGettingDeviceAndHostTi cl_ulong host_timestamp = 0; cl_ulong zero_timestamp = 0; - auto mDev = MockDevice::createWithNewExecutionEnvironment(nullptr); + auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; mDev->setOSTime(new FailOSTime()); retVal = clGetDeviceAndHostTimer( @@ -135,7 +135,7 @@ TEST_F(clGetHostTimerTest, GivenValidOSTimeWhenGettingHostTimerThenSuccessIsRetu cl_ulong host_timestamp = 0; cl_ulong zero_timestamp = 0; - auto mDev = MockDevice::createWithNewExecutionEnvironment(nullptr); + auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; mDev->setOSTime(new MockOSTime()); retVal = clGetHostTimer( @@ -152,7 +152,7 @@ TEST_F(clGetHostTimerTest, GivenInvalidOSTimeWhenGettingHostTimerThenOutOfResour cl_ulong host_timestamp = 0; cl_ulong zero_timestamp = 0; - auto mDev = MockDevice::createWithNewExecutionEnvironment(nullptr); + auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; mDev->setOSTime(new FailOSTime()); retVal = clGetHostTimer( diff --git a/unit_tests/api/cl_get_device_ids_tests.inl b/unit_tests/api/cl_get_device_ids_tests.inl index cbe2e0f4e4..01369ed374 100644 --- a/unit_tests/api/cl_get_device_ids_tests.inl +++ b/unit_tests/api/cl_get_device_ids_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -114,7 +114,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsThenAllRootDevi EXPECT_EQ(retVal, CL_SUCCESS); EXPECT_EQ(numEntries, numDevices); for (auto i = 0u; i < numRootDevices; i++) { - EXPECT_EQ(devices[i], platform()->getDevice(i)); + EXPECT_EQ(devices[i], platform()->getClDevice(i)); } } TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsButNumEntriesIsLowerThanNumDevicesThenSubsetOfRootDevicesIsReturned) { @@ -141,7 +141,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsButNumEntriesIs EXPECT_LT(numDevices, maxNumDevices); EXPECT_EQ(numEntries, numDevices); for (auto i = 0u; i < numEntries; i++) { - EXPECT_EQ(devices[i], platform()->getDevice(i)); + EXPECT_EQ(devices[i], platform()->getClDevice(i)); } EXPECT_EQ(devices[numEntries], dummyDevice); } @@ -166,7 +166,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesAndLimitedNumberOfReturnedDevic EXPECT_EQ(retVal, CL_SUCCESS); EXPECT_EQ(numEntries - 1, numDevices); for (auto i = 0u; i < numDevices; i++) { - EXPECT_EQ(devices[i], platform()->getDevice(i)); + EXPECT_EQ(devices[i], platform()->getClDevice(i)); } EXPECT_EQ(devices[numDevices], dummyDevice); } diff --git a/unit_tests/api/cl_get_device_info_tests.inl b/unit_tests/api/cl_get_device_info_tests.inl index 4145d4f527..ea00790726 100644 --- a/unit_tests/api/cl_get_device_info_tests.inl +++ b/unit_tests/api/cl_get_device_info_tests.inl @@ -191,7 +191,7 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh TEST_F(clGetDeviceInfoTests, GivenClDeviceIlVersionParamAndOcl21WhenGettingDeviceInfoThenSpirv12IsReturned) { size_t paramRetSize = 0; - Device *pDevice = castToObject(devices[testedRootDeviceIndex]); + ClDevice *pDevice = castToObject(devices[testedRootDeviceIndex]); if (pDevice->getSupportedClVersion() < 21) return; diff --git a/unit_tests/api/cl_get_event_profiling_info_tests.inl b/unit_tests/api/cl_get_event_profiling_info_tests.inl index edb9fa739b..d22eea6d4b 100644 --- a/unit_tests/api/cl_get_event_profiling_info_tests.inl +++ b/unit_tests/api/cl_get_event_profiling_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -258,9 +258,9 @@ class clEventProfilingWithPerfCountersTests : public DeviceInstrumentationFixtur PerformanceCountersDeviceFixture::SetUp(); DeviceInstrumentationFixture::SetUp(true); - cl_device_id clDevice = device.get(); + cl_device_id deviceId = device.get(); cl_int retVal = CL_SUCCESS; - context = std::unique_ptr(Context::create(nullptr, DeviceVector(&clDevice, 1), + context = std::unique_ptr(Context::create(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal)); commandQueue = std::make_unique(context.get(), device.get(), nullptr); event = std::make_unique(commandQueue.get(), 0, 0, 0); diff --git a/unit_tests/api/cl_get_kernel_sub_group_info_khr_tests.inl b/unit_tests/api/cl_get_kernel_sub_group_info_khr_tests.inl index 6342c2cb18..49202d426a 100644 --- a/unit_tests/api/cl_get_kernel_sub_group_info_khr_tests.inl +++ b/unit_tests/api/cl_get_kernel_sub_group_info_khr_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -79,7 +79,7 @@ TEST_P(KernelSubGroupInfoKhrReturnSizeTest, GivenLwsParameterWhenGettingMaxSubGr retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE, sizeof(size_t) * 3, inputValue, @@ -112,7 +112,7 @@ TEST_P(KernelSubGroupInfoKhrReturnCountTest, GivenLwsParameterWhenGettingSubGrou retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE, sizeof(size_t) * 3, inputValue, @@ -136,7 +136,7 @@ TEST_F(KernelSubGroupInfoKhrReturnCompileSizeTest, GivenKernelWhenGettingRequire retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL, 0, nullptr, @@ -162,7 +162,7 @@ TEST_F(KernelSubGroupInfoKhrReturnCompileSizeTest, GivenKernelWhenGettingRequire TEST_F(KernelSubGroupInfoKhrTest, GivenNullKernelWhenGettingKernelSubGroupInfoThenInvalidKernelErrorIsReturned) { retVal = clGetKernelSubGroupInfoKHR( nullptr, - pDevice, + pClDevice, 0, 0, nullptr, @@ -190,7 +190,7 @@ TEST_F(KernelSubGroupInfoKhrTest, GivenNullDeviceWhenGettingKernelSubGroupInfoTh TEST_F(KernelSubGroupInfoKhrTest, GivenInvalidParamNameWhenGettingKernelSubGroupInfoThenInvalidValueErrorIsReturned) { retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, 0, sizeof(size_t), inputValue, @@ -215,7 +215,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS // work dim == 0 retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, GetParam(), 0, inputValue, @@ -228,7 +228,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS // work dim % sizeof(size_t) != 0 retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, GetParam(), (sizeof(size_t) * MaxWorkDim) - 1, inputValue, @@ -241,7 +241,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS // work dim > MaxWorkDim retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t) * (MaxWorkDim + 1), inputValue, @@ -254,7 +254,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS // null input_value retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t) * (MaxWorkDim), nullptr, @@ -269,7 +269,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidParamSizeWhenGettingKer //param_value_size < sizeof(size_t) retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t), inputValue, @@ -283,7 +283,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidParamSizeWhenGettingKer TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenNoReturnPointerWhenGettingKernelSubGroupInfoThenSuccessIsReturned) { retVal = clGetKernelSubGroupInfoKHR( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t), inputValue, diff --git a/unit_tests/api/cl_get_kernel_sub_group_info_tests.inl b/unit_tests/api/cl_get_kernel_sub_group_info_tests.inl index 51e13baab1..7f27be91f6 100644 --- a/unit_tests/api/cl_get_kernel_sub_group_info_tests.inl +++ b/unit_tests/api/cl_get_kernel_sub_group_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -108,7 +108,7 @@ TEST_P(KernelSubGroupInfoReturnSizeTest, GivenWorkGroupSizeWhenGettingMaxSubGrou retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE, sizeof(size_t) * workDim, inputValue, @@ -162,7 +162,7 @@ TEST_P(KernelSubGroupInfoReturnCountTest, GivenWorkGroupSizeWhenGettingSubGroupC retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE, sizeof(size_t) * workDim, inputValue, @@ -210,7 +210,7 @@ TEST_P(KernelSubGroupInfoReturnLocalSizeTest, GivenWorkGroupSizeWhenGettingLocal retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(size_t), inputValue, @@ -243,7 +243,7 @@ TEST_F(KernelSubGroupInfoReturnMaxNumberTest, GivenWorkGroupSizeWhenGettingMaxNu if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) { retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, CL_KERNEL_MAX_NUM_SUB_GROUPS, 0, nullptr, @@ -263,7 +263,7 @@ TEST_F(KernelSubGroupInfoReturnCompileNumberTest, GivenKernelWhenGettingCompileN if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) { retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, CL_KERNEL_COMPILE_NUM_SUB_GROUPS, 0, nullptr, @@ -283,7 +283,7 @@ TEST_F(KernelSubGroupInfoReturnCompileSizeTest, GivenKernelWhenGettingCompileSub if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) { retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL, 0, nullptr, @@ -311,7 +311,7 @@ TEST_F(KernelSubGroupInfoTest, GivenNullKernelWhenGettingSubGroupInfoThenInvalid if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) { retVal = clGetKernelSubGroupInfo( nullptr, - pDevice, + pClDevice, 0, 0, nullptr, @@ -343,7 +343,7 @@ TEST_F(KernelSubGroupInfoTest, GivenInvalidParamNameWhenGettingSubGroupInfoThenI if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) { retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, 0, sizeof(size_t), inputValue, @@ -379,7 +379,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenOpenClVersionLowerThan21WhenGetti retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), 0, nullptr, @@ -402,7 +402,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenWorkDimZeroWhenGettingSubGroupInf retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), 0, inputValue, @@ -426,7 +426,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenIndivisibleWorkDimWhenGettingSubG retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), (sizeof(size_t) * workDim) - 1, inputValue, @@ -450,7 +450,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenWorkDimGreaterThanMaxWorkDimWhenG retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t) * (workDim + 1), inputValue, @@ -474,7 +474,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenInputValueIsNullWhenGettingSubGro retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t) * (workDim), nullptr, @@ -491,7 +491,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenParamValueSizeZeroWhenGettingSubG retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t), inputValue, @@ -509,7 +509,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenUnalignedParamValueSizeWhenGettin retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t), inputValue, @@ -529,7 +529,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenTooLargeParamValueSizeWhenGetting // paramValue size / sizeof(size_t) > MaxWorkDim retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t), inputValue, @@ -547,7 +547,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenNullPtrForReturnWhenGettingKernel retVal = clGetKernelSubGroupInfo( pKernel, - pDevice, + pClDevice, GetParam(), sizeof(size_t), inputValue, diff --git a/unit_tests/api/cl_get_kernel_work_group_info_tests.inl b/unit_tests/api/cl_get_kernel_work_group_info_tests.inl index 06ec6c2d7c..85775671ca 100644 --- a/unit_tests/api/cl_get_kernel_work_group_info_tests.inl +++ b/unit_tests/api/cl_get_kernel_work_group_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -100,7 +100,7 @@ TEST_P(clGetKernelWorkGroupInfoTests, GivenValidParametersWhenGettingKernelWorkG TEST_F(clGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceWhenGettingKernelWorkGroupInfoThenCorrectSpillMemSizeIsReturned) { size_t paramValueSizeRet; cl_ulong param_value; - auto pDevice = castToObject(devices[testedRootDeviceIndex]); + auto pDevice = castToObject(devices[testedRootDeviceIndex]); MockKernelWithInternals mockKernel(*pDevice); SPatchMediaVFEState mediaVFEstate; @@ -126,7 +126,7 @@ TEST_F(clGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceWhenGettin TEST_F(clGetKernelWorkGroupInfoTests, givenKernelHavingPrivateMemoryAllocationWhenAskedForPrivateAllocationSizeThenProperSizeIsReturned) { size_t paramValueSizeRet; cl_ulong param_value; - auto pDevice = castToObject(devices[testedRootDeviceIndex]); + auto pDevice = castToObject(devices[testedRootDeviceIndex]); MockKernelWithInternals mockKernel(*pDevice); SPatchAllocateStatelessPrivateSurface privateAllocation; @@ -149,7 +149,7 @@ TEST_F(clGetKernelWorkGroupInfoTests, givenKernelHavingPrivateMemoryAllocationWh TEST_F(clGetKernelWorkGroupInfoTests, givenKernelNotHavingPrivateMemoryAllocationWhenAskedForPrivateAllocationSizeThenZeroIsReturned) { size_t paramValueSizeRet; cl_ulong param_value; - auto pDevice = castToObject(devices[testedRootDeviceIndex]); + auto pDevice = castToObject(devices[testedRootDeviceIndex]); MockKernelWithInternals mockKernel(*pDevice); diff --git a/unit_tests/api/cl_get_platform_info_tests.inl b/unit_tests/api/cl_get_platform_info_tests.inl index a4d137caad..18b67711d4 100644 --- a/unit_tests/api/cl_get_platform_info_tests.inl +++ b/unit_tests/api/cl_get_platform_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -160,7 +160,7 @@ TEST_F(clGetPlatformInfoTests, GivenInvalidParamSizeWhenGettingPlatformInfoStrin TEST_F(clGetPlatformInfoTests, GivenDeviceWhenGettingIcdDispatchTableThenDeviceAndPlatformTablesMatch) { EXPECT_NE(pPlatform->dispatch.icdDispatch, nullptr); for (size_t deviceOrdinal = 0; deviceOrdinal < pPlatform->getNumDevices(); ++deviceOrdinal) { - auto device = pPlatform->getDevice(deviceOrdinal); + auto device = pPlatform->getClDevice(deviceOrdinal); ASSERT_NE(nullptr, device); EXPECT_EQ(pPlatform->dispatch.icdDispatch, device->dispatch.icdDispatch); } diff --git a/unit_tests/api/cl_get_supported_image_formats_tests.inl b/unit_tests/api/cl_get_supported_image_formats_tests.inl index 1fd84fac92..828cc64264 100644 --- a/unit_tests/api/cl_get_supported_image_formats_tests.inl +++ b/unit_tests/api/cl_get_supported_image_formats_tests.inl @@ -52,10 +52,10 @@ TEST_F(clGetSupportedImageFormatsTests, givenInvalidContextWhenGettingSupportIma TEST(clGetSupportedImageFormatsTest, givenPlatforNotSupportingImageWhenGettingSupportImageFormatsThenClInvalidValueIsReturned) { HardwareInfo hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsImages = false; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); cl_device_id clDevice = device.get(); cl_int retVal; - auto context = ReleaseableObjectPtr(Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); + auto context = ReleaseableObjectPtr(Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); cl_uint numImageFormats = 0; @@ -74,14 +74,14 @@ TEST(clGetSupportedImageFormatsTest, givenPlatformWithoutDevicesWhenClGetSupport auto executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment->initializeMemoryManager(); executionEnvironment->prepareRootDeviceEnvironments(1); - auto device = std::unique_ptr(Device::create(executionEnvironment, 0u)); + auto device = std::make_unique(*Device::create(executionEnvironment, 0u)); const DeviceInfo &devInfo = device->getDeviceInfo(); if (!devInfo.imageSupport) { GTEST_SKIP(); } cl_device_id clDevice = device.get(); cl_int retVal; - auto context = ReleaseableObjectPtr(Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); + auto context = ReleaseableObjectPtr(Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(0u, platform()->getNumDevices()); diff --git a/unit_tests/api/cl_mem_locally_uncached_resource_tests.cpp b/unit_tests/api/cl_mem_locally_uncached_resource_tests.cpp index 16c5f6f833..bd22f5e5c2 100644 --- a/unit_tests/api/cl_mem_locally_uncached_resource_tests.cpp +++ b/unit_tests/api/cl_mem_locally_uncached_resource_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -59,7 +59,7 @@ using clMemLocallyUncachedResourceFixture = TestpDevice, context, true); + MockKernelWithInternals mockKernel(*this->pClDevice, context, true); mockKernel.kernelInfo.usesSsh = true; mockKernel.kernelInfo.requiresSshForBuffers = true; @@ -136,7 +136,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, GivenAtLeastOneLocallyUncacheableR HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedInSurfaceStateWhenStatelessIsProgrammedItIsCached) { cl_int retVal = CL_SUCCESS; - MockKernelWithInternals mockKernel(*this->pDevice, context, true); + MockKernelWithInternals mockKernel(*this->pClDevice, context, true); auto kernel = mockKernel.mockKernel; mockKernel.kernelInfo.usesSsh = true; mockKernel.kernelInfo.requiresSshForBuffers = true; @@ -211,7 +211,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedInSurfa HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedButKernelDoesntHaveAnyStatelessAccessessThenSurfacesAreNotRecordedAsUncacheable) { cl_int retVal = CL_SUCCESS; - MockKernelWithInternals mockKernel(*this->pDevice, context, true); + MockKernelWithInternals mockKernel(*this->pClDevice, context, true); auto kernel = mockKernel.mockKernel; mockKernel.kernelInfo.usesSsh = true; mockKernel.kernelInfo.requiresSshForBuffers = true; @@ -290,7 +290,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedButKern HWTEST_F(clMemLocallyUncachedResourceFixture, WhenUnsettingUncacheableResourceFromKernelThanKernelContinuesToCorrectlySetMocs) { cl_int retVal = CL_SUCCESS; - MockKernelWithInternals mockKernel(*this->pDevice, context, true); + MockKernelWithInternals mockKernel(*this->pClDevice, context, true); auto kernel = mockKernel.mockKernel; mockKernel.kernelInfo.usesSsh = true; mockKernel.kernelInfo.requiresSshForBuffers = true; @@ -356,7 +356,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, WhenUnsettingUncacheableResourceFr HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedInSurfaceStateAndAreNotUsedInStatelessFashionThenThoseResourcesAreNotRegistredAsResourcesForCacheFlush) { cl_int retVal = CL_SUCCESS; - MockKernelWithInternals mockKernel(*this->pDevice, context, true); + MockKernelWithInternals mockKernel(*this->pClDevice, context, true); auto kernel = mockKernel.mockKernel; mockKernel.kernelInfo.usesSsh = true; mockKernel.kernelInfo.requiresSshForBuffers = true; diff --git a/unit_tests/api/cl_release_command_queue_tests.inl b/unit_tests/api/cl_release_command_queue_tests.inl index 18da2c05ab..73979a6661 100644 --- a/unit_tests/api/cl_release_command_queue_tests.inl +++ b/unit_tests/api/cl_release_command_queue_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,7 +24,7 @@ class clReleaseCommandQueueTypeTests : public DeviceHostQueueFixture {}; TYPED_TEST_CASE(clReleaseCommandQueueTypeTests, QueueTypes); TYPED_TEST(clReleaseCommandQueueTypeTests, GivenValidCmdQueueWhenReleasingCmdQueueThenSucessIsReturned) { - if (std::is_same::value && !castToObject(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { + if (std::is_same::value && !castToObject(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { return; } @@ -52,7 +52,7 @@ typedef api_tests clReleaseCommandQueueTests; TEST_F(clReleaseCommandQueueTests, givenBlockedEnqueueWithOutputEventStoredAsVirtualEventWhenReleasingCmdQueueThenInternalRefCountIsDecrementedAndQueueDeleted) { cl_command_queue cmdQ = nullptr; cl_queue_properties properties = 0; - Device *device = (Device *)devices[testedRootDeviceIndex]; + ClDevice *device = (ClDevice *)devices[testedRootDeviceIndex]; MockKernelWithInternals kernelInternals(*device, pContext); Kernel *kernel = kernelInternals.mockKernel; diff --git a/unit_tests/api/cl_retain_release_command_queue_tests.inl b/unit_tests/api/cl_retain_release_command_queue_tests.inl index f8ce6aeb80..4a413ea1c5 100644 --- a/unit_tests/api/cl_retain_release_command_queue_tests.inl +++ b/unit_tests/api/cl_retain_release_command_queue_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ class clRetainReleaseCommandQueueTests : public DeviceHostQueueFixture {}; TYPED_TEST_CASE(clRetainReleaseCommandQueueTests, QueueTypes); TYPED_TEST(clRetainReleaseCommandQueueTests, GivenValidCommandQueueWhenRetainingAndReleasingThenReferenceCountIsUpdatedCorrectly) { - if (std::is_same::value && !castToObject(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { + if (std::is_same::value && !castToObject(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { return; } diff --git a/unit_tests/api/cl_set_default_device_command_queue_tests.inl b/unit_tests/api/cl_set_default_device_command_queue_tests.inl index 902df39abc..21f2b7fdef 100644 --- a/unit_tests/api/cl_set_default_device_command_queue_tests.inl +++ b/unit_tests/api/cl_set_default_device_command_queue_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -61,7 +61,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenValidPar CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0, 0}; - auto pDevice = castToObject(devices[testedRootDeviceIndex]); + auto pDevice = castToObject(devices[testedRootDeviceIndex]); if (pDevice->getDeviceInfo().maxOnDeviceQueues > 1) { auto newDeviceQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], properties, &retVal); diff --git a/unit_tests/api/cl_set_kernel_arg_svm_pointer_tests.inl b/unit_tests/api/cl_set_kernel_arg_svm_pointer_tests.inl index d9759588bb..25f91b6125 100644 --- a/unit_tests/api/cl_set_kernel_arg_svm_pointer_tests.inl +++ b/unit_tests/api/cl_set_kernel_arg_svm_pointer_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -45,7 +45,7 @@ class KernelArgSvmFixture : public ApiFixture, public DeviceFixture { pKernelInfo->kernelArgInfo[0].typeStr = "char *"; pKernelInfo->kernelArgInfo[0].addressQualifier = CL_KERNEL_ARG_ADDRESS_GLOBAL; - pMockKernel = new MockKernel(pProgram, *pKernelInfo, *this->pDevice); + pMockKernel = new MockKernel(pProgram, *pKernelInfo, *this->pClDevice); ASSERT_EQ(CL_SUCCESS, pMockKernel->initialize()); pMockKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); } diff --git a/unit_tests/api/cl_set_kernel_exec_info_tests.inl b/unit_tests/api/cl_set_kernel_exec_info_tests.inl index af7341721a..18828aa2fd 100644 --- a/unit_tests/api/cl_set_kernel_exec_info_tests.inl +++ b/unit_tests/api/cl_set_kernel_exec_info_tests.inl @@ -20,7 +20,7 @@ class KernelExecInfoFixture : public ApiFixture { pKernelInfo = std::make_unique(); - pMockKernel = new MockKernel(pProgram, *pKernelInfo, *pPlatform->getDevice(0)); + pMockKernel = new MockKernel(pProgram, *pKernelInfo, *pPlatform->getClDevice(0)); ASSERT_EQ(CL_SUCCESS, pMockKernel->initialize()); svmCapabilities = pPlatform->getDevice(0)->getDeviceInfo().svmCapabilities; if (svmCapabilities != 0) { diff --git a/unit_tests/api/cl_svm_alloc_tests.inl b/unit_tests/api/cl_svm_alloc_tests.inl index 6688e90754..6f2d325e04 100644 --- a/unit_tests/api/cl_svm_alloc_tests.inl +++ b/unit_tests/api/cl_svm_alloc_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -40,14 +40,15 @@ TEST(clSVMAllocTest, givenPlatformWithoutDevicesWhenClSVMAllocIsCalledThenDevice auto executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment->initializeMemoryManager(); executionEnvironment->prepareRootDeviceEnvironments(1); - auto device = std::unique_ptr(Device::create(executionEnvironment, 0u)); + auto device = Device::create(executionEnvironment, 0u); + auto clDevice = std::make_unique(*device); const DeviceInfo &devInfo = device->getDeviceInfo(); if (devInfo.svmCapabilities == 0) { GTEST_SKIP(); } - cl_device_id clDevice = device.get(); + cl_device_id deviceId = clDevice.get(); cl_int retVal; - auto context = ReleaseableObjectPtr(Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); + auto context = ReleaseableObjectPtr(Context::create(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(0u, platform()->getNumDevices()); diff --git a/unit_tests/api/gl/cl_get_gl_context_info_khr_tests.cpp b/unit_tests/api/gl/cl_get_gl_context_info_khr_tests.cpp index f8ea562cfe..9411626333 100644 --- a/unit_tests/api/gl/cl_get_gl_context_info_khr_tests.cpp +++ b/unit_tests/api/gl/cl_get_gl_context_info_khr_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,7 +18,7 @@ typedef api_tests clGetGLContextInfoKHR_; namespace ULT { TEST_F(clGetGLContextInfoKHR_, success) { - auto expectedDevice = ::platform()->getDevice(0); + auto expectedDevice = ::platform()->getClDevice(0); cl_device_id retDevice = 0; size_t retSize = 0; diff --git a/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp index 4011aadbc1..79833ec614 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -32,7 +32,7 @@ struct CopyBufferHw typedef CopyBufferHw AUBCopyBuffer; HWTEST_P(AUBCopyBuffer, simple) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f}; cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f}; diff --git a/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp index b260578bad..a97ae88b0a 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -46,7 +46,7 @@ HWTEST_P(AUBCopyBufferRect, simple) { static const size_t rowPitch = 20; static const size_t slicePitch = rowPitch * rowPitch; static const size_t elementCount = slicePitch * rowPitch; - MockContext context(this->pDevice); + MockContext context(this->pClDevice); cl_uchar *srcMemory = new uint8_t[elementCount + 8]; cl_uchar *dstMemory = new uint8_t[elementCount + 8]; diff --git a/unit_tests/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp index 8fec323c71..0093a75527 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,7 +31,7 @@ struct AUBCopyImage } CommandDeviceFixture::SetUp(cl_command_queue_properties(0)); CommandStreamFixture::SetUp(pCmdQ); - context = std::make_unique(pDevice); + context = std::make_unique(pClDevice); } void TearDown() override { diff --git a/unit_tests/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp index 06260ce64d..7722ab2b2f 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -35,7 +35,7 @@ typedef FillBufferHw AUBFillBuffer; HWTEST_P(AUBFillBuffer, simple) { cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; auto pDestMemory = &destMemory[0]; - MockContext context(&this->pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]); auto retVal = CL_INVALID_VALUE; auto destBuffer = Buffer::create( &context, @@ -97,7 +97,7 @@ HWTEST_F(AUBFillBuffer, givenFillBufferWhenSeveralSubmissionsWithoutPollForCompl cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; auto pDestMemory = &destMemory[0]; - MockContext context(&this->pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]); auto retVal = CL_INVALID_VALUE; std::unique_ptr destBuffer(Buffer::create( &context, diff --git a/unit_tests/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp index 009735d55c..27054db826 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -97,7 +97,7 @@ struct AubFillImage CommandDeviceFixture::SetUp(cl_command_queue_properties(0)); CommandStreamFixture::SetUp(pCmdQ); - context = std::make_unique(pDevice); + context = std::make_unique(pClDevice); } void TearDown() override { diff --git a/unit_tests/aub_tests/command_queue/enqueue_map_buffer_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_map_buffer_aub_tests.cpp index 7b11e3be3f..6e06f19f07 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_map_buffer_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_map_buffer_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,7 +26,7 @@ struct AUBMapBuffer }; HWTEST_F(AUBMapBuffer, MapUpdateUnmapVerify) { - MockContext context(&this->pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]); auto retVal = CL_INVALID_VALUE; size_t bufferSize = 10; diff --git a/unit_tests/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp index 07eba88d6c..579c023107 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -44,7 +44,7 @@ struct AUBMapImage CommandDeviceFixture::SetUp(cl_command_queue_properties(0)); CommandStreamFixture::SetUp(pCmdQ); - context = std::make_unique(pDevice); + context = std::make_unique(pClDevice); } void TearDown() override { diff --git a/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp index a99d782ab1..adec87c237 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,7 +36,7 @@ struct ReadBufferHw typedef ReadBufferHw AUBReadBuffer; HWTEST_P(AUBReadBuffer, simple) { - MockContext context(this->pDevice); + MockContext context(this->pClDevice); cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f}; cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -112,7 +112,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) { return; } - MockContext context(this->pDevice); + MockContext context(this->pClDevice); cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f}; cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -171,7 +171,7 @@ struct AUBReadBufferUnaligned template void testReadBufferUnaligned(size_t offset, size_t size) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const auto bufferSize = sizeof(srcMemory); diff --git a/unit_tests/aub_tests/command_queue/enqueue_read_buffer_rect_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_read_buffer_rect_aub_tests.cpp index 6bc8fe4861..1ea2580a81 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_read_buffer_rect_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_read_buffer_rect_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -34,7 +34,7 @@ typedef ReadBufferRectHw AUBReadBufferRect; static const size_t width = 10; HWTEST_P(AUBReadBufferRect, simple3D) { - MockContext context(this->pDevice); + MockContext context(this->pClDevice); size_t rowPitch = width; size_t slicePitch = rowPitch * rowPitch; @@ -127,7 +127,7 @@ struct AUBReadBufferRectUnaligned template void testReadBufferUnaligned(size_t offset, size_t size) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const auto bufferSize = sizeof(srcMemory); diff --git a/unit_tests/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp index 1985883fe3..4422b89d6d 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -47,7 +47,7 @@ struct AUBReadImage CommandDeviceFixture::SetUp(cl_command_queue_properties(0)); CommandStreamFixture::SetUp(pCmdQ); - context = std::make_unique(pDevice); + context = std::make_unique(pClDevice); } void TearDown() override { diff --git a/unit_tests/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h b/unit_tests/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h index c0ec25a678..7f987219f7 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h +++ b/unit_tests/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -32,7 +32,7 @@ struct AUBImageUnaligned template void testReadImageUnaligned(size_t offset, size_t size, size_t pixelSize) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); char srcMemory[] = "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz"; const auto bufferSize = sizeof(srcMemory) - 1; @@ -128,7 +128,7 @@ struct AUBImageUnaligned void testWriteImageUnaligned(size_t offset, size_t size, size_t pixelSize) { DebugManagerStateRestore restorer; DebugManager.flags.ForceLinearImages.set(true); - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz"; const auto bufferSize = sizeof(srcMemory); diff --git a/unit_tests/aub_tests/command_queue/enqueue_verify_memory_buffer_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_verify_memory_buffer_aub_tests.cpp index 071f358ad8..7b379612f3 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_verify_memory_buffer_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_verify_memory_buffer_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -76,7 +76,7 @@ HWTEST_P(VerifyMemoryBufferHw, givenDifferentBuffersWhenValidatingMemoryThenSucc invalidContent2.get()[offset + itemOffset] = pTestItemWrong2[itemOffset]; } - MockContext context(&this->pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]); cl_int retVal = CL_INVALID_VALUE; std::unique_ptr buffer(Buffer::create( diff --git a/unit_tests/aub_tests/command_queue/enqueue_with_timestamp_packet_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_with_timestamp_packet_aub_tests.cpp index 18fe36efb5..d94510ef3a 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_with_timestamp_packet_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_with_timestamp_packet_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -29,7 +29,7 @@ struct TimestampPacketAubTests : public CommandEnqueueAUBFixture, public ::testi }; HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolvedThenDecrementCounterOnGpu) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); pCommandStreamReceiver->overrideDispatchPolicy(DispatchMode::BatchedDispatch); const size_t bufferSize = 1024; @@ -70,7 +70,7 @@ HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolve } HWTEST_F(TimestampPacketAubTests, givenMultipleWalkersWhenEnqueueingThenWriteAllTimestamps) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); const size_t bufferSize = 70; const size_t writeSize = bufferSize - 2; uint8_t writeData[writeSize] = {}; diff --git a/unit_tests/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp index aa844ffc6a..9d6726ac2b 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ struct WriteBufferHw typedef WriteBufferHw AUBWriteBuffer; HWTEST_P(AUBWriteBuffer, simple) { - MockContext context(&this->pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]); cl_float *srcMemory = new float[1024]; cl_float *destMemory = new float[1024]; @@ -124,7 +124,7 @@ struct AUBWriteBufferUnaligned template void testWriteBufferUnaligned(size_t offset, size_t size) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const auto bufferSize = sizeof(srcMemory); diff --git a/unit_tests/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp index fb5749dcc2..06486c6661 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -35,7 +35,7 @@ typedef WriteBufferRectHw AUBWriteBufferRect; static const size_t width = 10; HWTEST_P(AUBWriteBufferRect, simple3D) { - MockContext context(this->pDevice); + MockContext context(this->pClDevice); size_t rowPitch = width; size_t slicePitch = rowPitch * rowPitch; @@ -126,7 +126,7 @@ struct AUBWriteBufferRectUnaligned template void testWriteBufferUnaligned(size_t offset, size_t size) { - MockContext context(&pCmdQ->getDevice()); + MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]); char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const auto bufferSize = sizeof(srcMemory); diff --git a/unit_tests/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp b/unit_tests/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp index 13e4e17866..97ebfad168 100644 --- a/unit_tests/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp +++ b/unit_tests/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -45,7 +45,7 @@ struct AUBWriteImage CommandDeviceFixture::SetUp(cl_command_queue_properties(0)); CommandStreamFixture::SetUp(pCmdQ); - context = std::make_unique(pDevice); + context = std::make_unique(pClDevice); } void TearDown() override { diff --git a/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp b/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp index 2aefa80931..f7f612ae8c 100644 --- a/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp +++ b/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp @@ -29,7 +29,7 @@ struct AUBFixture : public AUBCommandStreamFixture, void SetUp() { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(nullptr, pDevice, 0); + CommandQueueFixture::SetUp(nullptr, pClDevice, 0); AUBCommandStreamFixture::SetUp(pCmdQ); } diff --git a/unit_tests/aub_tests/fixtures/aub_fixture.h b/unit_tests/aub_tests/fixtures/aub_fixture.h index 72484979b4..bd7d4f36f9 100644 --- a/unit_tests/aub_tests/fixtures/aub_fixture.h +++ b/unit_tests/aub_tests/fixtures/aub_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -43,7 +43,7 @@ class AUBFixture : public CommandQueueHwFixture { this->csr = AUBCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0); } - device.reset(MockDevice::create(executionEnvironment, deviceIndex)); + device = std::make_unique(MockDevice::create(executionEnvironment, deviceIndex)); device->resetCommandStreamReceiver(this->csr); CommandQueueHwFixture::SetUp(AUBFixture::device.get(), cl_command_queue_properties(0)); @@ -97,7 +97,7 @@ class AUBFixture : public CommandQueueHwFixture { CommandStreamReceiver *csr = nullptr; volatile uint32_t *pTagMemory = nullptr; - std::unique_ptr device; + std::unique_ptr device; ExecutionEnvironment *executionEnvironment; diff --git a/unit_tests/aub_tests/fixtures/aub_parent_kernel_fixture.h b/unit_tests/aub_tests/fixtures/aub_parent_kernel_fixture.h index c8342c8d22..95355741ae 100644 --- a/unit_tests/aub_tests/fixtures/aub_parent_kernel_fixture.h +++ b/unit_tests/aub_tests/fixtures/aub_parent_kernel_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,8 +24,8 @@ class AUBParentKernelFixture : public CommandEnqueueAUBFixture, GTEST_SKIP(); } CommandEnqueueAUBFixture::SetUp(); - ASSERT_NE(nullptr, pDevice); - HelloWorldKernelFixture::SetUp(pDevice, programFile, kernelName, "-cl-std=CL2.0"); + ASSERT_NE(nullptr, pClDevice); + HelloWorldKernelFixture::SetUp(pClDevice, programFile, kernelName, "-cl-std=CL2.0"); } void TearDown() { if (IsSkipped()) { diff --git a/unit_tests/aub_tests/fixtures/fixture_tests.cpp b/unit_tests/aub_tests/fixtures/fixture_tests.cpp index 7794684837..2daa37386f 100644 --- a/unit_tests/aub_tests/fixtures/fixture_tests.cpp +++ b/unit_tests/aub_tests/fixtures/fixture_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,7 +25,7 @@ struct SimpleTest : public CommandDeviceFixture, void SetUp() override { CommandDeviceFixture::SetUp(cl_command_queue_properties(0)); AUBCommandStreamFixture::SetUp(pCmdQ); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); } void TearDown() override { delete context; diff --git a/unit_tests/aub_tests/fixtures/run_kernel_fixture.h b/unit_tests/aub_tests/fixtures/run_kernel_fixture.h index 6939824cbb..d6f95d8be4 100644 --- a/unit_tests/aub_tests/fixtures/run_kernel_fixture.h +++ b/unit_tests/aub_tests/fixtures/run_kernel_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -62,7 +62,7 @@ class RunKernelFixture : public CommandEnqueueAUBFixture { EXPECT_NE(nullptr, pSource); Program *pProgram = nullptr; - const cl_device_id device = pDevice; + const cl_device_id device = pClDevice; const unsigned char *binaries[1] = {reinterpret_cast(pSource.get())}; pProgram = Program::create( diff --git a/unit_tests/aub_tests/fixtures/simple_arg_fixture.h b/unit_tests/aub_tests/fixtures/simple_arg_fixture.h index 18e1b7af8d..9be93aa73d 100644 --- a/unit_tests/aub_tests/fixtures/simple_arg_fixture.h +++ b/unit_tests/aub_tests/fixtures/simple_arg_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -56,13 +56,13 @@ struct SimpleArgFixture : public FixtureFactory::IndirectHeapFixture, public: virtual void SetUp() { DeviceFixture::SetUp(); - ASSERT_NE(nullptr, pDevice); - CommandQueueFixture::SetUp(pDevice, 0); + ASSERT_NE(nullptr, pClDevice); + CommandQueueFixture::SetUp(pClDevice, 0); ASSERT_NE(nullptr, pCmdQ); CommandStreamFixture::SetUp(pCmdQ); ASSERT_NE(nullptr, pCS); IndirectHeapFixture::SetUp(pCmdQ); - KernelFixture::SetUp(pDevice); + KernelFixture::SetUp(pClDevice); ASSERT_NE(nullptr, pKernel); argVal = static_cast(0x22222222); diff --git a/unit_tests/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp b/unit_tests/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp index a219271177..405eb653ca 100644 --- a/unit_tests/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp +++ b/unit_tests/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,7 +25,7 @@ GEN11TEST_F(GEN11AUBParentKernelFixture, EnqueueParentKernel) { DeviceQueue *devQueue = DeviceQueue::create( &pCmdQ->getContext(), - pDevice, + pClDevice, properties[0], retVal); diff --git a/unit_tests/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp b/unit_tests/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp index 5ba4b6ea55..830fca66d4 100644 --- a/unit_tests/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp +++ b/unit_tests/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,7 +36,7 @@ GEN12LPTEST_F(Gen12LPAubBatchBufferTests, givenSimpleCCSWithBatchBufferWhenItHas GEN12LPTEST_F(Gen12LPTimestampTests, DISABLED_GivenCommandQueueWithProfilingEnabledWhenKernelIsEnqueuedThenProfilingTimestampsAreNotZero) { cl_queue_properties properties[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - CommandQueueHw cmdQ(pContext, pDevice, &properties[0]); + CommandQueueHw cmdQ(pContext, pClDevice, &properties[0]); EXPECT_EQ(aub_stream::ENGINE_CCS, pDevice->getDefaultEngine().osContext->getEngineType()); const uint32_t bufferSize = 4; diff --git a/unit_tests/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp b/unit_tests/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp index 58e35d85a0..fe1296359a 100644 --- a/unit_tests/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp +++ b/unit_tests/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,7 +25,7 @@ GEN12LPTEST_F(GEN12LPAUBParentKernelFixture, EnqueueParentKernel) { DeviceQueue *devQueue = DeviceQueue::create( &pCmdQ->getContext(), - pDevice, + pClDevice, properties[0], retVal); diff --git a/unit_tests/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp b/unit_tests/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp index 31d9f62267..b68ff777d6 100644 --- a/unit_tests/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp +++ b/unit_tests/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,7 @@ GEN8TEST_F(GEN8AUBParentKernelFixture, EnqueueParentKernel) { std::unique_ptr devQueue(DeviceQueue::create( &pCmdQ->getContext(), - pDevice, + pClDevice, properties[0], retVal)); diff --git a/unit_tests/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp b/unit_tests/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp index 54773a0896..fb85abd4a7 100644 --- a/unit_tests/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp +++ b/unit_tests/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,7 +23,7 @@ GEN9TEST_F(AUBParentKernelFixture, EnqueueParentKernel) { DeviceQueue *devQueue = DeviceQueue::create( &pCmdQ->getContext(), - pDevice, + pClDevice, properties[0], retVal); diff --git a/unit_tests/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp b/unit_tests/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp index 37efd9ebc3..7880ea8385 100644 --- a/unit_tests/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp +++ b/unit_tests/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -42,7 +42,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, ooqExecution) { Program *pProgram = CreateProgramFromBinary(kernelFilename); ASSERT_NE(nullptr, pProgram); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; retVal = pProgram->build( 1, &device, @@ -171,7 +171,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, ooqExecution) { // Create a second command queue (beyond the default one) CommandQueue *pCmdQ2 = nullptr; - pCmdQ2 = createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); + pCmdQ2 = createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); ASSERT_NE(nullptr, pCmdQ2); auto &csr = pCmdQ2->getGpgpuCommandStreamReceiver(); @@ -269,7 +269,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) { Program *pProgram = CreateProgramFromBinary(kernelFilename); ASSERT_NE(nullptr, pProgram); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; retVal = pProgram->build( 1, diff --git a/unit_tests/built_ins/built_in_tests.cpp b/unit_tests/built_ins/built_in_tests.cpp index 2c8349d8a0..718d8eddba 100644 --- a/unit_tests/built_ins/built_in_tests.cpp +++ b/unit_tests/built_ins/built_in_tests.cpp @@ -59,7 +59,7 @@ class BuiltInTests void SetUp() override { DebugManager.flags.ForceAuxTranslationMode.set(static_cast(AuxTranslationMode::Builtin)); DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); BuiltInFixture::SetUp(pDevice); } @@ -470,8 +470,8 @@ HWTEST_F(BuiltInTests, givenKernelWithAuxTranslationRequiredWhenEnqueueCalledThe auto mockBuiltinKernel = MockKernel::create(*pDevice, mockProgram.get()); mockAuxBuiltInOp->usedKernels.at(0).reset(mockBuiltinKernel); - MockKernelWithInternals mockKernel(*pDevice, pContext); - MockCommandQueueHw cmdQ(pContext, pDevice, nullptr); + MockKernelWithInternals mockKernel(*pClDevice, pContext); + MockCommandQueueHw cmdQ(pContext, pClDevice, nullptr); size_t gws[3] = {1, 0, 0}; MockBuffer buffer; cl_mem clMem = &buffer; @@ -1039,7 +1039,7 @@ TEST_F(VmeBuiltInTests, BuiltinDispatchInfoBuilderVMEBuilderNullKernel) { } TEST_F(VmeBuiltInTests, BuiltinDispatchInfoBuilderVMEBuilder) { - MockKernelWithInternals mockKernel{*pDevice}; + MockKernelWithInternals mockKernel{*pClDevice}; ((SPatchExecutionEnvironment *)mockKernel.kernelInfo.patchInfo.executionEnvironment)->CompiledSIMD32 = 0; ((SPatchExecutionEnvironment *)mockKernel.kernelInfo.patchInfo.executionEnvironment)->CompiledSIMD16 = 1; mockKernel.kernelInfo.reqdWorkGroupSize[0] = 16; @@ -1089,7 +1089,7 @@ TEST_F(VmeBuiltInTests, BuiltinDispatchInfoBuilderVMEBuilder) { } TEST_F(VmeBuiltInTests, BuiltinDispatchInfoBuilderAdvancedVMEBuilder) { - MockKernelWithInternals mockKernel{*pDevice}; + MockKernelWithInternals mockKernel{*pClDevice}; ((SPatchExecutionEnvironment *)mockKernel.kernelInfo.patchInfo.executionEnvironment)->CompiledSIMD32 = 0; ((SPatchExecutionEnvironment *)mockKernel.kernelInfo.patchInfo.executionEnvironment)->CompiledSIMD16 = 1; mockKernel.kernelInfo.reqdWorkGroupSize[0] = 16; @@ -1365,7 +1365,7 @@ TEST_F(BuiltInTests, getBuiltinResourcesForTypeSource) { EXPECT_NE(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, BuiltinCode::ECodeType::Source, *pDevice).size()); EXPECT_EQ(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::COUNT, BuiltinCode::ECodeType::Source, *pDevice).size()); - if (pDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { + if (pClDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { EXPECT_EQ(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::Scheduler, BuiltinCode::ECodeType::Source, *pDevice).size()); } } @@ -1393,7 +1393,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, BuiltInTests, getBuiltinResourcesForTypeBinary) { EXPECT_EQ(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::VmeBlockMotionEstimateIntel, BuiltinCode::ECodeType::Binary, *pDevice).size()); EXPECT_EQ(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, BuiltinCode::ECodeType::Binary, *pDevice).size()); EXPECT_EQ(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, BuiltinCode::ECodeType::Binary, *pDevice).size()); - if (this->pDevice->getEnabledClVersion() >= 20) { + if (this->pClDevice->getEnabledClVersion() >= 20) { EXPECT_NE(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::Scheduler, BuiltinCode::ECodeType::Binary, *pDevice).size()); } EXPECT_EQ(0u, mockBuiltinsLib->getBuiltinResource(EBuiltInOps::COUNT, BuiltinCode::ECodeType::Binary, *pDevice).size()); @@ -1487,7 +1487,7 @@ TEST_F(BuiltInTests, whenQueriedProperVmeVersionIsReturned) { GTEST_SKIP(); } cl_uint param; - auto ret = pDevice->getDeviceInfo(CL_DEVICE_ME_VERSION_INTEL, sizeof(param), ¶m, nullptr); + auto ret = pClDevice->getDeviceInfo(CL_DEVICE_ME_VERSION_INTEL, sizeof(param), ¶m, nullptr); EXPECT_EQ(CL_SUCCESS, ret); EXPECT_EQ(static_cast(CL_ME_VERSION_ADVANCED_VER_2_INTEL), param); } @@ -2057,7 +2057,7 @@ TEST_F(BuiltInTests, getSipKernelReturnsProgramCreatedOutOfIsaAcquiredFromCompil errCode = p->processGenBinary(); ASSERT_EQ(CL_SUCCESS, errCode); - const SipKernel &sipKern = mockBuiltins.getSipKernel(SipKernelType::Csr, *pContext->getDevice(0)); + const SipKernel &sipKern = mockBuiltins.getSipKernel(SipKernelType::Csr, pContext->getDevice(0)->getDevice()); const auto &sipKernelInfo = p->getKernelInfo(static_cast(0)); @@ -2072,7 +2072,7 @@ TEST_F(BuiltInTests, getSipKernelReturnsProgramCreatedOutOfIsaAcquiredFromCompil } TEST_F(BuiltInTests, givenSipKernelWhenItIsCreatedThenItHasGraphicsAllocationForKernel) { - const SipKernel &sipKern = pDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, *pContext->getDevice(0)); + const SipKernel &sipKern = pDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, pContext->getDevice(0)->getDevice()); auto sipAllocation = sipKern.getSipAllocation(); EXPECT_NE(nullptr, sipAllocation); } diff --git a/unit_tests/command_queue/blit_enqueue_tests.cpp b/unit_tests/command_queue/blit_enqueue_tests.cpp index 5161c6dd05..93fcb0923c 100644 --- a/unit_tests/command_queue/blit_enqueue_tests.cpp +++ b/unit_tests/command_queue/blit_enqueue_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,7 +21,7 @@ using namespace NEO; struct BlitAuxTranslationTests : public ::testing::Test { class BcsMockContext : public MockContext { public: - BcsMockContext(Device *device) : MockContext(device) { + BcsMockContext(ClDevice *device) : MockContext(device) { bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex())); bcsCsr->setupContext(*bcsOsContext); @@ -57,7 +57,7 @@ struct BlitAuxTranslationTests : public ::testing::Test { DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.set(1); DebugManager.flags.ForceAuxTranslationMode.set(1); DebugManager.flags.CsrDispatchMode.set(static_cast(DispatchMode::ImmediateDispatch)); - device.reset(MockDevice::createWithNewExecutionEnvironment(nullptr)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto &capabilityTable = device->getExecutionEnvironment()->getMutableHardwareInfo()->capabilityTable; bool createBcsEngine = !capabilityTable.blitterOperationsSupported; capabilityTable.blitterOperationsSupported = true; @@ -68,7 +68,6 @@ struct BlitAuxTranslationTests : public ::testing::Test { engine.osContext = bcsOsContext.get(); engine.commandStreamReceiver->setupContext(*bcsOsContext); } - bcsMockContext = std::make_unique(device.get()); auto mockCmdQueue = new MockCommandQueueHw(bcsMockContext.get(), device.get(), nullptr); commandQueue.reset(mockCmdQueue); @@ -160,7 +159,7 @@ struct BlitAuxTranslationTests : public ::testing::Test { DebugManagerStateRestore restore; std::unique_ptr bcsOsContext; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr bcsMockContext; std::unique_ptr commandQueue; std::unique_ptr mockKernel; diff --git a/unit_tests/command_queue/command_enqueue_fixture.h b/unit_tests/command_queue/command_enqueue_fixture.h index 86c2e6cf93..d3715aba30 100644 --- a/unit_tests/command_queue/command_enqueue_fixture.h +++ b/unit_tests/command_queue/command_enqueue_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,7 +23,7 @@ struct CommandDeviceFixture : public DeviceFixture, using CommandQueueHwFixture::SetUp; void SetUp(cl_command_queue_properties cmdQueueProperties = 0) { DeviceFixture::SetUp(); - CommandQueueHwFixture::SetUp(pDevice, cmdQueueProperties); + CommandQueueHwFixture::SetUp(pClDevice, cmdQueueProperties); } void TearDown() { @@ -95,7 +95,7 @@ struct NegativeFailAllocationCommandEnqueueBaseFixture : public CommandEnqueueBa template struct CommandQueueStateless : public CommandQueueHw { - CommandQueueStateless(Context *context, Device *device) : CommandQueueHw(context, device, nullptr){}; + CommandQueueStateless(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr){}; void enqueueHandlerHook(const unsigned int commandType, const MultiDispatchInfo &dispatchInfo) override { auto kernel = dispatchInfo.begin()->getKernel(); @@ -106,7 +106,7 @@ struct CommandQueueStateless : public CommandQueueHw { template struct CommandQueueStateful : public CommandQueueHw { - CommandQueueStateful(Context *context, Device *device) : CommandQueueHw(context, device, nullptr){}; + CommandQueueStateful(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr){}; void enqueueHandlerHook(const unsigned int commandType, const MultiDispatchInfo &dispatchInfo) override { auto kernel = dispatchInfo.begin()->getKernel(); diff --git a/unit_tests/command_queue/command_queue_fixture.cpp b/unit_tests/command_queue/command_queue_fixture.cpp index 8334d6038a..95ef9251ef 100644 --- a/unit_tests/command_queue/command_queue_fixture.cpp +++ b/unit_tests/command_queue/command_queue_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,7 +20,7 @@ namespace NEO { extern CommandQueueCreateFunc commandQueueFactory[IGFX_MAX_CORE]; CommandQueue *CommandQueueHwFixture::createCommandQueue( - Device *pDevice, + ClDevice *pDevice, cl_command_queue_properties properties) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, properties, 0}; @@ -28,12 +28,12 @@ CommandQueue *CommandQueueHwFixture::createCommandQueue( } CommandQueue *CommandQueueHwFixture::createCommandQueue( - Device *pDevice, + ClDevice *pDevice, const cl_command_queue_properties *properties) { if (pDevice == nullptr) { if (this->device == nullptr) { - this->device = MockDevice::createWithNewExecutionEnvironment(nullptr); + this->device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; } pDevice = this->device; } @@ -53,7 +53,7 @@ void CommandQueueHwFixture::SetUp() { } void CommandQueueHwFixture::SetUp( - Device *pDevice, + ClDevice *pDevice, cl_command_queue_properties properties) { ASSERT_NE(nullptr, pDevice); context = new MockContext(pDevice); @@ -82,7 +82,7 @@ CommandQueueFixture::CommandQueueFixture() CommandQueue *CommandQueueFixture::createCommandQueue( Context *context, - Device *device, + ClDevice *device, cl_command_queue_properties properties) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, properties, 0}; return new CommandQueue( @@ -93,7 +93,7 @@ CommandQueue *CommandQueueFixture::createCommandQueue( void CommandQueueFixture::SetUp( Context *context, - Device *device, + ClDevice *device, cl_command_queue_properties properties) { pCmdQ = createCommandQueue( context, diff --git a/unit_tests/command_queue/command_queue_fixture.h b/unit_tests/command_queue/command_queue_fixture.h index 54d895f0dc..f5dc3b6940 100644 --- a/unit_tests/command_queue/command_queue_fixture.h +++ b/unit_tests/command_queue/command_queue_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,32 +16,32 @@ namespace NEO { class Device; struct CommandQueueHwFixture { - CommandQueue *createCommandQueue(Device *device) { + CommandQueue *createCommandQueue(ClDevice *device) { return createCommandQueue(device, cl_command_queue_properties{0}); } CommandQueue *createCommandQueue( - Device *device, + ClDevice *device, cl_command_queue_properties properties); CommandQueue *createCommandQueue( - Device *device, + ClDevice *device, const cl_command_queue_properties *properties); virtual void SetUp(); - virtual void SetUp(Device *_pDevice, cl_command_queue_properties properties); + virtual void SetUp(ClDevice *_pDevice, cl_command_queue_properties properties); virtual void TearDown(); CommandQueue *pCmdQ = nullptr; - Device *device = nullptr; + ClDevice *device = nullptr; MockContext *context = nullptr; }; struct OOQueueFixture : public CommandQueueHwFixture { typedef CommandQueueHwFixture BaseClass; - virtual void SetUp(Device *_pDevice, cl_command_queue_properties _properties) override { + virtual void SetUp(ClDevice *_pDevice, cl_command_queue_properties _properties) override { ASSERT_NE(nullptr, _pDevice); BaseClass::pCmdQ = BaseClass::createCommandQueue(_pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); ASSERT_NE(nullptr, BaseClass::pCmdQ); @@ -53,13 +53,13 @@ struct CommandQueueFixture { virtual void SetUp( Context *context, - Device *device, + ClDevice *device, cl_command_queue_properties properties); virtual void TearDown(); CommandQueue *createCommandQueue( Context *context, - Device *device, + ClDevice *device, cl_command_queue_properties properties); CommandQueue *pCmdQ; diff --git a/unit_tests/command_queue/command_queue_hw_tests.cpp b/unit_tests/command_queue/command_queue_hw_tests.cpp index a0513e10d7..83a680c0cc 100644 --- a/unit_tests/command_queue/command_queue_hw_tests.cpp +++ b/unit_tests/command_queue/command_queue_hw_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -35,9 +35,9 @@ struct CommandQueueHwTest void SetUp() override { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); - CommandQueueHwFixture::SetUp(pDevice, 0); + CommandQueueHwFixture::SetUp(pClDevice, 0); } void TearDown() override { @@ -61,12 +61,12 @@ struct OOQueueHwTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); - OOQueueFixture::SetUp(pDevice, 0); + OOQueueFixture::SetUp(pClDevice, 0); } - void SetUp(Device *pDevice, cl_command_queue_properties properties) override { + void SetUp(ClDevice *pDevice, cl_command_queue_properties properties) override { } void TearDown() override { @@ -279,7 +279,7 @@ HWTEST_F(CommandQueueHwTest, GivenEventWhenEnqueuingBlockedMapUnmapOperationThen HWTEST_F(CommandQueueHwTest, GivenNonEmptyQueueOnBlockingMapBufferWillWaitForPrecedingCommandsToComplete) { struct MockCmdQ : CommandQueueHw { - MockCmdQ(Context *context, Device *device) + MockCmdQ(Context *context, ClDevice *device) : CommandQueueHw(context, device, 0) { finishWasCalled = false; } @@ -291,7 +291,7 @@ HWTEST_F(CommandQueueHwTest, GivenNonEmptyQueueOnBlockingMapBufferWillWaitForPre bool finishWasCalled; }; - MockCmdQ cmdQ(context, &pCmdQ->getDevice()); + MockCmdQ cmdQ(context, platform()->clDeviceMap[&pCmdQ->getDevice()]); auto b1 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr); auto b2 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr); @@ -356,7 +356,7 @@ HWTEST_F(CommandQueueHwTest, GivenNotCompleteUserEventPassedToEnqueueWhenEventIs auto userEvent = make_releaseable(context); KernelInfo kernelInfo; - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; auto mockProgram = mockKernelWithInternals.mockProgram; @@ -391,7 +391,7 @@ typedef CommandQueueHwTest BlockedCommandQueueTest; HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhenBlockedCommandIsBeingSubmittedThenQueueHeapsAreNotUsed) { UserEvent userEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -417,7 +417,7 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhenBlockedCommandIsBeingSubm HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWithUsedHeapsWhenBlockedCommandIsBeingSubmittedThenQueueHeapsAreNotUsed) { UserEvent userEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -449,7 +449,7 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWithUsedHeapsWhenBlockedComma HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUnusedHeapsWhenBlockedCommandIsBeingSubmittedThenThoseHeapsAreBeingUsed) { UserEvent userEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -477,7 +477,7 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUnusedHeapsWhenBl HWTEST_F(BlockedCommandQueueTest, givenEnqueueBlockedByUserEventWhenItIsEnqueuedThenKernelReferenceCountIsIncreased) { UserEvent userEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -497,10 +497,10 @@ typedef CommandQueueHwTest CommandQueueHwRefCountTest; HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWhenNewBlockedEnqueueReplacesVirtualEventThenPreviousVirtualEventDecrementsCmdQRefCount) { cl_int retVal = 0; - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); UserEvent userEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -529,10 +529,10 @@ HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWhenNewBlockedEnqueueReplac HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWithOutputEventAsVirtualEventWhenNewBlockedEnqueueReplacesVirtualEventCreatedFromOutputEventThenPreviousVirtualEventDoesntDecrementRefCount) { cl_int retVal = 0; - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); UserEvent userEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -574,10 +574,10 @@ HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWithOutputEventAsVirtualEve HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenEveryEventIsDeletedAndCmdQIsReleasedThenCmdQIsDeleted) { cl_int retVal = 0; - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); UserEvent *userEvent = new UserEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -624,10 +624,10 @@ HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenEveryEventI HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenCmdQIsReleasedBeforeOutputEventThenOutputEventDeletesCmdQ) { cl_int retVal = 0; - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); UserEvent *userEvent = new UserEvent(context); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; @@ -964,14 +964,14 @@ HWTEST_F(CommandQueueHwTest, givenEventWithRecordedCommandWhenSubmitCommandIsCal HWTEST_F(CommandQueueHwTest, GivenBuiltinKernelWhenBuiltinDispatchInfoBuilderIsProvidedThenThisBuilderIsUsedForCreatingDispatchInfo) { CommandQueueHw *cmdQHw = static_cast *>(this->pCmdQ); - MockKernelWithInternals mockKernelToUse(*pDevice); + MockKernelWithInternals mockKernelToUse(*pClDevice); MockBuilder builder(*pDevice->getExecutionEnvironment()->getBuiltIns()); builder.paramsToUse.gws.x = 11; builder.paramsToUse.elws.x = 13; builder.paramsToUse.offset.x = 17; builder.paramsToUse.kernel = mockKernelToUse.mockKernel; - MockKernelWithInternals mockKernelToSend(*pDevice); + MockKernelWithInternals mockKernelToSend(*pClDevice); mockKernelToSend.kernelInfo.builtinDispatchBuilder = &builder; NullSurface s; Surface *surfaces[] = {&s}; @@ -1000,7 +1000,7 @@ HWTEST_F(CommandQueueHwTest, GivenBuiltinKernelWhenBuiltinDispatchInfoBuilderIsP HWTEST_F(CommandQueueHwTest, givenNonBlockedEnqueueWhenEventIsPassedThenUpdateItsFlushStamp) { CommandQueueHw *cmdQHw = static_cast *>(this->pCmdQ); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto &csr = pDevice->getUltCommandStreamReceiver(); csr.flushStamp->setStamp(5); @@ -1021,7 +1021,7 @@ HWTEST_F(CommandQueueHwTest, givenBlockedEnqueueWhenEventIsPassedThenDontUpdateI UserEvent userEvent; cl_event event, clUserEvent; CommandQueueHw *cmdQHw = static_cast *>(this->pCmdQ); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto &csr = pDevice->getUltCommandStreamReceiver(); csr.flushStamp->setStamp(5); @@ -1052,7 +1052,7 @@ HWTEST_F(CommandQueueHwTest, givenBlockedInOrderCmdQueueAndAsynchronouslyComplet pDevice->resetCommandStreamReceiver(mockCSR); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; size_t size = 1; @@ -1095,7 +1095,7 @@ HWTEST_F(CommandQueueHwTest, givenBlockedOutOfOrderQueueWhenUserEventIsSubmitted CommandQueueHw *cmdQHw = static_cast *>(this->pCmdQ); auto &mockCsr = pDevice->getUltCommandStreamReceiver(); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; size_t size = 1; @@ -1131,7 +1131,7 @@ HWTEST_F(OOQueueHwTest, givenBlockedOutOfOrderCmdQueueAndAsynchronouslyCompleted auto mockCSR = new MockCsr(executionStamp, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCSR); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; size_t offset = 0; size_t size = 1; @@ -1177,7 +1177,7 @@ HWTEST_F(OOQueueHwTest, givenBlockedOutOfOrderCmdQueueAndAsynchronouslyCompleted HWTEST_F(CommandQueueHwTest, givenWalkerSplitEnqueueNDRangeWhenNoBlockedThenKernelMakeResidentCalledOnce) { KernelInfo kernelInfo; - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; auto mockProgram = mockKernelWithInternals.mockProgram; mockProgram->setAllowNonUniform(true); @@ -1196,7 +1196,7 @@ HWTEST_F(CommandQueueHwTest, givenWalkerSplitEnqueueNDRangeWhenNoBlockedThenKern HWTEST_F(CommandQueueHwTest, givenWalkerSplitEnqueueNDRangeWhenBlockedThenKernelGetResidencyCalledOnce) { UserEvent userEvent(context); KernelInfo kernelInfo; - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto mockKernel = mockKernelWithInternals.mockKernel; auto mockProgram = mockKernelWithInternals.mockProgram; mockProgram->setAllowNonUniform(true); diff --git a/unit_tests/command_queue/command_queue_tests.cpp b/unit_tests/command_queue/command_queue_tests.cpp index 0a8191ef24..22abebca0c 100644 --- a/unit_tests/command_queue/command_queue_tests.cpp +++ b/unit_tests/command_queue/command_queue_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -51,6 +51,7 @@ struct CommandQueueMemoryDevice void TearDown() override { DeviceFixture::TearDown(); + platformImpl.reset(); MemoryManagementFixture::TearDown(); } }; @@ -71,9 +72,9 @@ struct CommandQueueTest CommandQueueMemoryDevice::SetUp(); properties = GetParam(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); - CommandQueueFixture::SetUp(pContext, pDevice, properties); + CommandQueueFixture::SetUp(pContext, pClDevice, properties); } void TearDown() override { @@ -91,7 +92,7 @@ TEST_P(CommandQueueTest, GivenNonFailingAllocationWhenCreatingCommandQueueThenCo auto retVal = CL_INVALID_VALUE; auto pCmdQ = CommandQueue::create( pContext, - pDevice, + pClDevice, nullptr, retVal); @@ -126,7 +127,7 @@ struct GetTagTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(nullptr, pDevice, 0); + CommandQueueFixture::SetUp(nullptr, pClDevice, 0); CommandStreamFixture::SetUp(pCmdQ); } @@ -145,7 +146,7 @@ TEST_F(GetTagTest, GivenSetHwTagWhenGettingHwTagThenCorrectTagIsReturned) { TEST_F(GetTagTest, GivenInitialValueWhenGettingHwTagThenCorrectTagIsReturned) { MockContext context; - CommandQueue commandQueue(&context, pDevice, 0); + CommandQueue commandQueue(&context, pClDevice, 0); EXPECT_EQ(initialHardwareTag, commandQueue.getHwTag()); } @@ -201,7 +202,7 @@ TEST(CommandQueue, GivenOOQwhenUpdateFromCompletionStampWithTrueIsCalledThenTask } TEST(CommandQueue, givenDeviceWhenCreatingCommandQueueThenPickCsrFromDefaultEngine) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); CommandQueue cmdQ(nullptr, mockDevice.get(), 0); auto defaultCsr = mockDevice->getDefaultEngine().commandStreamReceiver; @@ -211,7 +212,7 @@ TEST(CommandQueue, givenDeviceWhenCreatingCommandQueueThenPickCsrFromDefaultEngi TEST(CommandQueue, givenDeviceNotSupportingBlitOperationsWhenQueueIsCreatedThenDontRegisterBcsCsr) { HardwareInfo hwInfo = *platformDevices[0]; hwInfo.capabilityTable.blitterOperationsSupported = false; - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); CommandQueue cmdQ(nullptr, mockDevice.get(), 0); EXPECT_EQ(nullptr, cmdQ.getBcsCommandStreamReceiver()); @@ -226,7 +227,7 @@ HWTEST_F(CommandQueueWithSubDevicesTest, givenDeviceWithSubDevicesSupportingBlit HardwareInfo hwInfo = *platformDevices[0]; bool createBcsEngine = !hwInfo.capabilityTable.blitterOperationsSupported; hwInfo.capabilityTable.blitterOperationsSupported = true; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); EXPECT_EQ(2u, device->getNumAvailableDevices()); std::unique_ptr bcsOsContext; @@ -247,7 +248,7 @@ HWTEST_F(CommandQueueWithSubDevicesTest, givenDeviceWithSubDevicesSupportingBlit } TEST(CommandQueue, givenCmdQueueBlockedByReadyVirtualEventWhenUnblockingThenUpdateFlushTaskFromEvent) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = new MockContext; auto cmdQ = new CommandQueue(context, mockDevice.get(), 0); auto userEvent = new Event(cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0); @@ -268,7 +269,7 @@ TEST(CommandQueue, givenCmdQueueBlockedByReadyVirtualEventWhenUnblockingThenUpda TEST(CommandQueue, givenCmdQueueBlockedByAbortedVirtualEventWhenUnblockingThenUpdateFlushTaskFromEvent) { auto context = new MockContext; - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto cmdQ = new CommandQueue(context, mockDevice.get(), 0); auto userEvent = new Event(cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0); @@ -292,7 +293,7 @@ struct CommandQueueCommandStreamTest : public CommandQueueMemoryDevice, public ::testing::Test { void SetUp() override { CommandQueueMemoryDevice::SetUp(); - context.reset(new MockContext(pDevice)); + context.reset(new MockContext(pClDevice)); } void TearDown() override { @@ -304,7 +305,7 @@ struct CommandQueueCommandStreamTest : public CommandQueueMemoryDevice, HWTEST_F(CommandQueueCommandStreamTest, givenCommandQueueThatWaitsOnAbortedUserEventWhenIsQueueBlockedIsCalledThenTaskLevelAlignsToCsr) { MockContext context; - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); CommandQueue cmdQ(&context, mockDevice.get(), 0); auto &commandStreamReceiver = mockDevice->getUltCommandStreamReceiver(); @@ -321,7 +322,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenCommandQueueThatWaitsOnAbortedUserE TEST_F(CommandQueueCommandStreamTest, GivenValidCommandQueueWhenGettingCommandStreamThenValidObjectIsReturned) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue commandQueue(context.get(), pDevice, props); + CommandQueue commandQueue(context.get(), pClDevice, props); auto &cs = commandQueue.getCS(1024); EXPECT_NE(nullptr, &cs); @@ -329,7 +330,7 @@ TEST_F(CommandQueueCommandStreamTest, GivenValidCommandQueueWhenGettingCommandSt TEST_F(CommandQueueCommandStreamTest, GivenValidCommandStreamWhenGettingGraphicsAllocationThenMaxAvailableSpaceAndUnderlyingBufferSizeAreCorrect) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue commandQueue(context.get(), pDevice, props); + CommandQueue commandQueue(context.get(), pClDevice, props); size_t minSizeRequested = 20; auto &cs = commandQueue.getCS(minSizeRequested); @@ -346,7 +347,7 @@ TEST_F(CommandQueueCommandStreamTest, GivenValidCommandStreamWhenGettingGraphics TEST_F(CommandQueueCommandStreamTest, GivenRequiredSizeWhenGettingCommandStreamThenMaxAvailableSpaceIsEqualOrGreaterThanRequiredSize) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue commandQueue(context.get(), pDevice, props); + CommandQueue commandQueue(context.get(), pClDevice, props); size_t requiredSize = 16384; const auto &commandStream = commandQueue.getCS(requiredSize); @@ -356,7 +357,7 @@ TEST_F(CommandQueueCommandStreamTest, GivenRequiredSizeWhenGettingCommandStreamT TEST_F(CommandQueueCommandStreamTest, WhenGettingCommandStreamWithNewSizeThenMaxAvailableSpaceIsEqualOrGreaterThanNewSize) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue commandQueue(context.get(), pDevice, props); + CommandQueue commandQueue(context.get(), pClDevice, props); auto &commandStreamInitial = commandQueue.getCS(1024); size_t requiredSize = commandStreamInitial.getMaxAvailableSpace() + 42; @@ -368,7 +369,7 @@ TEST_F(CommandQueueCommandStreamTest, WhenGettingCommandStreamWithNewSizeThenMax TEST_F(CommandQueueCommandStreamTest, givenCommandStreamReceiverWithReusableAllocationsWhenAskedForCommandStreamThenReturnsAllocationFromReusablePool) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto memoryManager = pDevice->getMemoryManager(); size_t requiredSize = alignUp(100 + CSRequirements::minCommandQueueCommandStreamSize + CSRequirements::csOverfetchSize, MemoryConstants::pageSize64k); @@ -387,7 +388,7 @@ TEST_F(CommandQueueCommandStreamTest, givenCommandStreamReceiverWithReusableAllo } TEST_F(CommandQueueCommandStreamTest, givenCommandQueueWhenItIsDestroyedThenCommandStreamIsPutOnTheReusabeList) { - auto cmdQ = new CommandQueue(context.get(), pDevice, 0); + auto cmdQ = new CommandQueue(context.get(), pClDevice, 0); const auto &commandStream = cmdQ->getCS(100); auto graphicsAllocation = commandStream.getGraphicsAllocation(); EXPECT_TRUE(pDevice->getDefaultEngine().commandStreamReceiver->getAllocationsForReuse().peekIsEmpty()); @@ -400,7 +401,7 @@ TEST_F(CommandQueueCommandStreamTest, givenCommandQueueWhenItIsDestroyedThenComm TEST_F(CommandQueueCommandStreamTest, WhenAskedForNewCommandStreamThenOldHeapIsStoredForReuse) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); EXPECT_TRUE(pDevice->getDefaultEngine().commandStreamReceiver->getAllocationsForReuse().peekIsEmpty()); @@ -419,7 +420,7 @@ TEST_F(CommandQueueCommandStreamTest, WhenAskedForNewCommandStreamThenOldHeapIsS TEST_F(CommandQueueCommandStreamTest, givenCommandQueueWhenGetCSIsCalledThenCommandStreamAllocationTypeShouldBeSetToCommandBuffer) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); const auto &commandStream = cmdQ.getCS(100); auto commandStreamAllocation = commandStream.getGraphicsAllocation(); @@ -432,9 +433,9 @@ HWTEST_F(CommandQueueCommandStreamTest, givenMultiDispatchInfoWithSingleKernelWi DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(0); - MockCommandQueueHw cmdQ(context.get(), pDevice, nullptr); + MockCommandQueueHw cmdQ(context.get(), pClDevice, nullptr); pDevice->getUltCommandStreamReceiver().multiOsContextCapable = true; - MockKernelWithInternals mockKernelWithInternals(*pDevice, context.get()); + MockKernelWithInternals mockKernelWithInternals(*pClDevice, context.get()); mockKernelWithInternals.mockKernel->kernelArgRequiresCacheFlush.resize(1); MockGraphicsAllocation cacheRequiringAllocation; @@ -450,8 +451,8 @@ HWTEST_F(CommandQueueCommandStreamTest, givenMultiDispatchInfoWithSingleKernelWi DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - MockCommandQueueHw cmdQ(context.get(), pDevice, nullptr); - MockKernelWithInternals mockKernelWithInternals(*pDevice, context.get()); + MockCommandQueueHw cmdQ(context.get(), pClDevice, nullptr); + MockKernelWithInternals mockKernelWithInternals(*pClDevice, context.get()); mockKernelWithInternals.mockKernel->kernelArgRequiresCacheFlush.resize(1); MockGraphicsAllocation cacheRequiringAllocation; @@ -467,7 +468,7 @@ struct CommandQueueIndirectHeapTest : public CommandQueueMemoryDevice, public ::testing::TestWithParam { void SetUp() override { CommandQueueMemoryDevice::SetUp(); - context.reset(new MockContext(pDevice)); + context.reset(new MockContext(pClDevice)); } void TearDown() override { @@ -479,7 +480,7 @@ struct CommandQueueIndirectHeapTest : public CommandQueueMemoryDevice, TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenValidObjectIsReturned) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), 8192); EXPECT_NE(nullptr, &indirectHeap); @@ -487,7 +488,7 @@ TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenValidObjectIsRet TEST_P(CommandQueueIndirectHeapTest, givenIndirectObjectHeapWhenItIsQueriedForInternalAllocationThenTrueIsReturned) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), 8192); if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT) { @@ -499,7 +500,7 @@ TEST_P(CommandQueueIndirectHeapTest, givenIndirectObjectHeapWhenItIsQueriedForIn HWTEST_P(CommandQueueIndirectHeapTest, GivenIndirectHeapWhenGettingAvailableSpaceThenCorrectSizeIsReturned) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), sizeof(uint32_t)); if (this->GetParam() == IndirectHeap::SURFACE_STATE) { @@ -512,7 +513,7 @@ HWTEST_P(CommandQueueIndirectHeapTest, GivenIndirectHeapWhenGettingAvailableSpac TEST_P(CommandQueueIndirectHeapTest, GivenRequiredSizeWhenGettingIndirectHeapThenIndirectHeapHasRequiredSize) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); size_t requiredSize = 16384; const auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), requiredSize); @@ -522,7 +523,7 @@ TEST_P(CommandQueueIndirectHeapTest, GivenRequiredSizeWhenGettingIndirectHeapThe TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapWithNewSizeThenMaxAvailableSpaceIsEqualOrGreaterThanNewSize) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto &indirectHeapInitial = cmdQ.getIndirectHeap(this->GetParam(), 10); size_t requiredSize = indirectHeapInitial.getMaxAvailableSpace() + 42; @@ -540,7 +541,7 @@ TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapWithNewSizeThenMaxAv TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenSizeIsAlignedToCacheLine) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); size_t minHeapSize = 64 * KB; auto &indirectHeapInitial = cmdQ.getIndirectHeap(this->GetParam(), 2 * minHeapSize + 1); @@ -557,7 +558,7 @@ TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenSizeIsAlignedToC TEST_P(CommandQueueIndirectHeapTest, givenCommandStreamReceiverWithReusableAllocationsWhenAskedForHeapAllocationThenAllocationFromReusablePoolIsReturned) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto memoryManager = pDevice->getMemoryManager(); @@ -597,7 +598,7 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandStreamReceiverWithReusableAlloc HWTEST_P(CommandQueueIndirectHeapTest, WhenAskedForNewHeapThenOldHeapIsStoredForReuse) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); EXPECT_TRUE(commandStreamReceiver.getAllocationsForReuse().peekIsEmpty()); @@ -620,7 +621,7 @@ HWTEST_P(CommandQueueIndirectHeapTest, WhenAskedForNewHeapThenOldHeapIsStoredFor TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithoutHeapAllocationWhenAskedForNewHeapThenNewAllocationIsAcquiredWithoutStoring) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - MockCommandQueue cmdQ(context.get(), pDevice, props); + MockCommandQueue cmdQ(context.get(), pClDevice, props); auto memoryManager = pDevice->getMemoryManager(); auto &csr = pDevice->getUltCommandStreamReceiver(); @@ -642,7 +643,7 @@ TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithoutHeapAllocationWhenA } TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWithResourceCachingActiveWhenQueueISDestroyedThenIndirectHeapIsNotOnReuseList) { - auto cmdQ = new CommandQueue(context.get(), pDevice, 0); + auto cmdQ = new CommandQueue(context.get(), pClDevice, 0); cmdQ->getIndirectHeap(this->GetParam(), 100); EXPECT_TRUE(pDevice->getDefaultEngine().commandStreamReceiver->getAllocationsForReuse().peekIsEmpty()); @@ -653,7 +654,7 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWithResourceCachingActiveW TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithHeapAllocatedWhenIndirectHeapIsReleasedThenHeapAllocationAndHeapBufferIsSetToNullptr) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - MockCommandQueue cmdQ(context.get(), pDevice, props); + MockCommandQueue cmdQ(context.get(), pClDevice, props); EXPECT_TRUE(pDevice->getDefaultEngine().commandStreamReceiver->getAllocationsForReuse().peekIsEmpty()); @@ -676,7 +677,7 @@ TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithHeapAllocatedWhenIndir TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithoutHeapAllocatedWhenIndirectHeapIsReleasedThenIndirectHeapAllocationStaysNull) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - MockCommandQueue cmdQ(context.get(), pDevice, props); + MockCommandQueue cmdQ(context.get(), pClDevice, props); cmdQ.releaseIndirectHeap(this->GetParam()); auto &csr = pDevice->getUltCommandStreamReceiver(); @@ -686,7 +687,7 @@ TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithoutHeapAllocatedWhenIn TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithHeapWhenGraphicAllocationIsNullThenNothingOnReuseList) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - MockCommandQueue cmdQ(context.get(), pDevice, props); + MockCommandQueue cmdQ(context.get(), pClDevice, props); auto &ih = cmdQ.getIndirectHeap(this->GetParam(), 0u); auto allocation = ih.getGraphicsAllocation(); @@ -706,7 +707,7 @@ TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithHeapWhenGraphicAllocat TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetIndirectHeapIsCalledThenIndirectHeapAllocationTypeShouldBeSetToInternalHeapForIohAndLinearStreamForOthers) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); auto heapType = this->GetParam(); @@ -723,7 +724,7 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetIndirectHeapIsCalle TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetHeapMemoryIsCalledThenHeapIsCreated) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); IndirectHeap *indirectHeap = nullptr; cmdQ.allocateHeapMemory(this->GetParam(), 100, indirectHeap); @@ -736,7 +737,7 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetHeapMemoryIsCalledT TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetHeapMemoryIsCalledWithAlreadyAllocatedHeapThenGraphicsAllocationIsCreated) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - CommandQueue cmdQ(context.get(), pDevice, props); + CommandQueue cmdQ(context.get(), pClDevice, props); IndirectHeap heap(nullptr, size_t{100}); @@ -758,7 +759,7 @@ INSTANTIATE_TEST_CASE_P( using CommandQueueTests = ::testing::Test; HWTEST_F(CommandQueueTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGraphicsAllocationIsReused) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); MockContext context(device.get()); std::unique_ptr commandQ(new CommandQueue(&context, device.get(), 0)); *device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 0; @@ -776,7 +777,7 @@ HWTEST_F(CommandQueueTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGra struct WaitForQueueCompletionTests : public ::testing::Test { template struct MyCmdQueue : public CommandQueueHw { - MyCmdQueue(Context *context, Device *device) : CommandQueueHw(context, device, nullptr){}; + MyCmdQueue(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr){}; void waitUntilComplete(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) override { requestedUseQuickKmdSleep = useQuickKmdSleep; waitUntilCompleteCounter++; @@ -789,11 +790,11 @@ struct WaitForQueueCompletionTests : public ::testing::Test { }; void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; }; @@ -862,7 +863,7 @@ TEST(CommandQueue, givenEnqueuesForSharedObjectsWithImageWhenUsingSharingHandler } TEST(CommandQueue, givenEnqueuesForSharedObjectsWithImageWhenUsingSharingHandlerWithEventThenReturnSuccess) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext context; CommandQueue cmdQ(&context, mockDevice.get(), 0); MockSharingHandler *mockSharingHandler = new MockSharingHandler; @@ -1003,7 +1004,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenDebugKernelWhenSetupDebugSurfaceIsC MockProgram program(*pDevice->getExecutionEnvironment()); program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*pDevice, &program)); - CommandQueue cmdQ(context.get(), pDevice, 0); + CommandQueue cmdQ(context.get(), pClDevice, 0); kernel->setSshLocal(nullptr, sizeof(RENDER_SURFACE_STATE) + kernel->getAllocatedKernelInfo()->patchInfo.pAllocateSystemThreadSurface->Offset); kernel->getAllocatedKernelInfo()->usesSsh = true; @@ -1022,7 +1023,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenCsrWithDebugSurfaceAllocatedWhenSet MockProgram program(*pDevice->getExecutionEnvironment()); program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*pDevice, &program)); - CommandQueue cmdQ(context.get(), pDevice, 0); + CommandQueue cmdQ(context.get(), pClDevice, 0); kernel->setSshLocal(nullptr, sizeof(RENDER_SURFACE_STATE) + kernel->getAllocatedKernelInfo()->patchInfo.pAllocateSystemThreadSurface->Offset); kernel->getAllocatedKernelInfo()->usesSsh = true; diff --git a/unit_tests/command_queue/dispatch_walker_tests.cpp b/unit_tests/command_queue/dispatch_walker_tests.cpp index 304d694ea6..89c82919fa 100644 --- a/unit_tests/command_queue/dispatch_walker_tests.cpp +++ b/unit_tests/command_queue/dispatch_walker_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -35,8 +35,8 @@ struct DispatchWalkerTest : public CommandQueueFixture, public DeviceFixture, pu void SetUp() override { DebugManager.flags.EnableTimestampPacket.set(0); DeviceFixture::SetUp(); - context = std::make_unique(pDevice); - CommandQueueFixture::SetUp(context.get(), pDevice, 0); + context = std::make_unique(pClDevice); + CommandQueueFixture::SetUp(context.get(), pClDevice, 0); program = std::make_unique(*pDevice->getExecutionEnvironment()); @@ -144,7 +144,7 @@ HWTEST_F(DispatchWalkerTest, givenSimd1WhenSetGpgpuWalkerThreadDataThenSimdInWal } HWTEST_F(DispatchWalkerTest, WhenDispatchingWalkerThenCommandStreamMemoryIsntChanged) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); auto &commandStream = pCmdQ->getCS(4096); @@ -191,7 +191,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalIdsWhenDispatchingWalkerThenWalkerIsDis threadPayload.LocalIDZPresent = 0; threadPayload.UnusedPerThreadConstantPresent = 1; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); auto &commandStream = pCmdQ->getCS(4096); @@ -233,7 +233,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalIdsWhenDispatchingWalkerThenWalkerIsDis } HWTEST_F(DispatchWalkerTest, GivenDefaultLwsAlgorithmWhenDispatchingWalkerThenDimensionsAreCorrect) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.workDimOffset = 0; ASSERT_EQ(CL_SUCCESS, kernel.initialize()); @@ -264,7 +264,7 @@ HWTEST_F(DispatchWalkerTest, GivenSquaredLwsAlgorithmWhenDispatchingWalkerThenDi DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeND.set(false); DebugManager.flags.EnableComputeWorkSizeSquared.set(true); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.workDimOffset = 0; ASSERT_EQ(CL_SUCCESS, kernel.initialize()); @@ -292,7 +292,7 @@ HWTEST_F(DispatchWalkerTest, GivenSquaredLwsAlgorithmWhenDispatchingWalkerThenDi HWTEST_F(DispatchWalkerTest, GivenNdLwsAlgorithmWhenDispatchingWalkerThenDimensionsAreCorrect) { DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeND.set(true); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.workDimOffset = 0; ASSERT_EQ(CL_SUCCESS, kernel.initialize()); @@ -321,7 +321,7 @@ HWTEST_F(DispatchWalkerTest, GivenOldLwsAlgorithmWhenDispatchingWalkerThenDimens DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeND.set(false); DebugManager.flags.EnableComputeWorkSizeSquared.set(false); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.workDimOffset = 0; ASSERT_EQ(CL_SUCCESS, kernel.initialize()); @@ -347,7 +347,7 @@ HWTEST_F(DispatchWalkerTest, GivenOldLwsAlgorithmWhenDispatchingWalkerThenDimens } HWTEST_F(DispatchWalkerTest, GivenNumWorkGroupsWhenDispatchingWalkerThenNumWorkGroupsIsCorrectlySet) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.numWorkGroupsOffset[0] = 0; kernelInfo.workloadInfo.numWorkGroupsOffset[1] = 4; kernelInfo.workloadInfo.numWorkGroupsOffset[2] = 8; @@ -380,7 +380,7 @@ HWTEST_F(DispatchWalkerTest, GivenNumWorkGroupsWhenDispatchingWalkerThenNumWorkG HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndDefaultAlgorithmWhenDispatchingWalkerThenLwsIsCorrect) { DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeND.set(false); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; @@ -410,7 +410,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndDefaultAlgorithmWhenDispatch HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndNdOnWhenDispatchingWalkerThenLwsIsCorrect) { DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeND.set(true); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; @@ -441,7 +441,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndSquaredAlgorithmWhenDispatch DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(true); DebugManager.flags.EnableComputeWorkSizeND.set(false); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; @@ -472,7 +472,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndSquaredAlgorithmOffAndNdOffW DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(false); DebugManager.flags.EnableComputeWorkSizeND.set(false); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; @@ -500,7 +500,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndSquaredAlgorithmOffAndNdOffW } HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeWhenDispatchingWalkerThenLwsIsCorrect) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; @@ -529,7 +529,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeWhenDispatchingWalkerThenLwsIsC } HWTEST_F(DispatchWalkerTest, GivenTwoSetsOfLwsOffsetsWhenDispatchingWalkerThenLwsIsCorrect) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; @@ -564,13 +564,13 @@ HWTEST_F(DispatchWalkerTest, GivenTwoSetsOfLwsOffsetsWhenDispatchingWalkerThenLw } HWTEST_F(DispatchWalkerTest, GivenSplitKernelWhenDispatchingWalkerThenLwsIsCorrect) { - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); - MockKernel kernel2(program.get(), kernelInfoWithSampler, *pDevice); + MockKernel kernel2(program.get(), kernelInfoWithSampler, *pClDevice); kernelInfoWithSampler.workloadInfo.localWorkSizeOffsets[0] = 12; kernelInfoWithSampler.workloadInfo.localWorkSizeOffsets[1] = 16; kernelInfoWithSampler.workloadInfo.localWorkSizeOffsets[2] = 20; @@ -610,8 +610,8 @@ HWTEST_F(DispatchWalkerTest, GivenSplitKernelWhenDispatchingWalkerThenLwsIsCorre } HWTEST_F(DispatchWalkerTest, GivenSplitWalkerWhenDispatchingWalkerThenLwsIsCorrect) { - MockKernel kernel1(program.get(), kernelInfo, *pDevice); - MockKernel mainKernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); + MockKernel mainKernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.localWorkSizeOffsets[0] = 0; kernelInfo.workloadInfo.localWorkSizeOffsets[1] = 4; kernelInfo.workloadInfo.localWorkSizeOffsets[2] = 8; @@ -669,7 +669,7 @@ HWTEST_F(DispatchWalkerTest, GivenSplitWalkerWhenDispatchingWalkerThenLwsIsCorre } HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenCommandSteamIsNotConsumed) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -703,7 +703,7 @@ HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenCommandSt } HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenRequiredHeaSizesAreTakenFromKernel) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -743,7 +743,7 @@ HWTEST_F(DispatchWalkerTest, givenBlockedEnqueueWhenObtainingCommandStreamThenAl multiDispatchInfo.push(dispatchInfo); std::unique_ptr blockedKernelData; - MockCommandQueueHw mockCmdQ(nullptr, pDevice, nullptr); + MockCommandQueueHw mockCmdQ(nullptr, pClDevice, nullptr); auto expectedSizeCSAllocation = MemoryConstants::pageSize64k; auto expectedSizeCS = MemoryConstants::pageSize64k - CSRequirements::csOverfetchSize; @@ -761,7 +761,7 @@ HWTEST_F(DispatchWalkerTest, givenBlockedEnqueueWhenObtainingCommandStreamThenAl } HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenRequiredHeapSizesAreTakenFromMdi) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); MockMultiDispatchInfo multiDispatchInfo(&kernel); @@ -789,7 +789,7 @@ HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenRequiredH } HWTEST_F(DispatchWalkerTest, givenBlockedQueueWhenDispatchWalkerIsCalledThenCommandStreamHasGpuAddress) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); MockMultiDispatchInfo multiDispatchInfo(&kernel); @@ -810,7 +810,7 @@ HWTEST_F(DispatchWalkerTest, givenBlockedQueueWhenDispatchWalkerIsCalledThenComm } HWTEST_F(DispatchWalkerTest, givenThereAreAllocationsForReuseWhenDispatchWalkerIsCalledThenCommandStreamObtainsReusableAllocation) { - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); MockMultiDispatchInfo multiDispatchInfo(&kernel); @@ -837,9 +837,9 @@ HWTEST_F(DispatchWalkerTest, givenThereAreAllocationsForReuseWhenDispatchWalkerI } HWTEST_F(DispatchWalkerTest, GivenMultipleKernelsWhenDispatchingWalkerThenWorkDimensionsAreCorrect) { - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); - MockKernel kernel2(program.get(), kernelInfo, *pDevice); + MockKernel kernel2(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); @@ -872,9 +872,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch auto gpuAddress1 = kernelIsaAllocation->getGpuAddressToPatch(); auto gpuAddress2 = kernelIsaWithSamplerAllocation->getGpuAddressToPatch(); - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); - MockKernel kernel2(program.get(), kernelInfoWithSampler, *pDevice); + MockKernel kernel2(program.get(), kernelInfoWithSampler, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); @@ -959,9 +959,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatchingWalkerThenGpgpuWalkerIdOffsetIsProgrammedCorrectly) { using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); - MockKernel kernel2(program.get(), kernelInfoWithSampler, *pDevice); + MockKernel kernel2(program.get(), kernelInfoWithSampler, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); @@ -1004,9 +1004,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatchingWalkerThenThreadGroupIdStartingCoordinatesAreProgrammedCorrectly) { using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); - MockKernel kernel2(program.get(), kernelInfoWithSampler, *pDevice); + MockKernel kernel2(program.get(), kernelInfoWithSampler, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); @@ -1053,7 +1053,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleDispatchInfoAndSameKernelWhenDispatchingWalkerThenGpgpuWalkerThreadGroupIdStartingCoordinatesAreCorrectlyProgrammed) { using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); DispatchInfo di1(&kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}, {100, 1, 1}, {10, 1, 1}, {10, 1, 1}, {10, 1, 1}, {0, 0, 0}); @@ -1106,7 +1106,7 @@ HWTEST_F(DispatchWalkerTest, GivenCacheFlushAfterWalkerDisabledWhenAllocationReq DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(0); - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); kernel1.kernelArgRequiresCacheFlush.resize(1); MockGraphicsAllocation cacheRequiringAllocation; @@ -1139,9 +1139,9 @@ HWTEST_F(DispatchWalkerTest, GivenCacheFlushAfterWalkerEnabledWhenWalkerWithTwoK DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); - MockKernel kernel2(program.get(), kernelInfoWithSampler, *pDevice); + MockKernel kernel2(program.get(), kernelInfoWithSampler, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); kernel1.kernelArgRequiresCacheFlush.resize(1); @@ -1177,9 +1177,9 @@ HWTEST_F(DispatchWalkerTest, GivenCacheFlushAfterWalkerEnabledWhenTwoWalkersForQ DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - MockKernel kernel1(program.get(), kernelInfo, *pDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); - MockKernel kernel2(program.get(), kernelInfoWithSampler, *pDevice); + MockKernel kernel2(program.get(), kernelInfoWithSampler, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); kernel1.kernelArgRequiresCacheFlush.resize(1); @@ -1245,7 +1245,7 @@ HWTEST_F(DispatchWalkerTest, givenKernelWhenAuxToNonAuxWhenTranslationRequiredTh BuiltinDispatchInfoBuilder &baseBuilder = builtIns->getBuiltinDispatchInfoBuilder(EBuiltInOps::AuxTranslation, context, *pDevice); auto &builder = static_cast &>(baseBuilder); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.workDimOffset = 0; ASSERT_EQ(CL_SUCCESS, kernel.initialize()); @@ -1301,7 +1301,7 @@ HWTEST_F(DispatchWalkerTest, givenKernelWhenNonAuxToAuxWhenTranslationRequiredTh BuiltinDispatchInfoBuilder &baseBuilder = builtIns->getBuiltinDispatchInfoBuilder(EBuiltInOps::AuxTranslation, context, *pDevice); auto &builder = static_cast &>(baseBuilder); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); kernelInfo.workloadInfo.workDimOffset = 0; ASSERT_EQ(CL_SUCCESS, kernel.initialize()); diff --git a/unit_tests/command_queue/enqueue_command_without_kernel_tests.cpp b/unit_tests/command_queue/enqueue_command_without_kernel_tests.cpp index 938bdd428f..4369934c78 100644 --- a/unit_tests/command_queue/enqueue_command_without_kernel_tests.cpp +++ b/unit_tests/command_queue/enqueue_command_without_kernel_tests.cpp @@ -35,7 +35,7 @@ class MockCommandQueueWithCacheFlush : public MockCommandQueueHw { HWTEST_F(EnqueueHandlerTest, GivenCommandStreamWithoutKernelWhenCommandEnqueuedThenTaskCountIncreased) { - std::unique_ptr> mockCmdQ(new MockCommandQueueHw(context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueHw(context, pClDevice, 0)); char buffer[64]; std::unique_ptr allocation(new MockGraphicsAllocation(buffer, sizeof(buffer))); @@ -53,7 +53,7 @@ HWTEST_F(EnqueueHandlerTest, GivenCommandStreamWithoutKernelWhenCommandEnqueuedT } HWTEST_F(EnqueueHandlerTest, givenNonBlitPropertyWhenEnqueueIsBlockedThenDontRegisterBlitProperties) { - std::unique_ptr> mockCmdQ(new MockCommandQueueHw(context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueHw(context, pClDevice, 0)); auto &csr = mockCmdQ->getGpgpuCommandStreamReceiver(); auto commandStream = new LinearStream(); @@ -77,7 +77,7 @@ HWTEST_F(EnqueueHandlerTest, givenNonBlitPropertyWhenEnqueueIsBlockedThenDontReg } HWTEST_F(EnqueueHandlerTest, givenBlitPropertyWhenEnqueueIsBlockedThenRegisterBlitProperties) { - std::unique_ptr> mockCmdQ(new MockCommandQueueHw(context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueHw(context, pClDevice, 0)); auto &csr = mockCmdQ->getGpgpuCommandStreamReceiver(); auto commandStream = new LinearStream(); @@ -231,7 +231,7 @@ HWTEST_F(DispatchFlagsTests, givenN1EnabledWhenDispatchingWithoutKernelTheAllowO } HWTEST_F(EnqueueHandlerTest, GivenCommandStreamWithoutKernelAndZeroSurfacesWhenEnqueuedHandlerThenProgramPipeControl) { - std::unique_ptr> mockCmdQ(new MockCommandQueueWithCacheFlush(context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueWithCacheFlush(context, pClDevice, 0)); mockCmdQ->commandRequireCacheFlush = true; MultiDispatchInfo multiDispatch; @@ -249,7 +249,7 @@ HWTEST_F(EnqueueHandlerTest, givenTimestampPacketWriteEnabledAndCommandWithCache auto mockTagAllocator = new MockTagAllocator<>(csr.rootDeviceIndex, pDevice->getMemoryManager()); csr.timestampPacketAllocator.reset(mockTagAllocator); - std::unique_ptr> mockCmdQ(new MockCommandQueueWithCacheFlush(context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueWithCacheFlush(context, pClDevice, 0)); mockCmdQ->commandRequireCacheFlush = true; cl_event event; @@ -266,7 +266,7 @@ HWTEST_F(EnqueueHandlerTest, givenTimestampPacketWriteDisabledAndCommandWithCach auto mockTagAllocator = new MockTagAllocator<>(pDevice->getRootDeviceIndex(), pDevice->getMemoryManager()); csr.timestampPacketAllocator.reset(mockTagAllocator); - std::unique_ptr> mockCmdQ(new MockCommandQueueWithCacheFlush(context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueWithCacheFlush(context, pClDevice, 0)); mockCmdQ->commandRequireCacheFlush = true; cl_event event; diff --git a/unit_tests/command_queue/enqueue_copy_buffer_rect_tests.cpp b/unit_tests/command_queue/enqueue_copy_buffer_rect_tests.cpp index 9c517e4c9d..b7edf2a943 100644 --- a/unit_tests/command_queue/enqueue_copy_buffer_rect_tests.cpp +++ b/unit_tests/command_queue/enqueue_copy_buffer_rect_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -405,12 +405,12 @@ struct EnqueueCopyBufferRectHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); dstBuffer = std::unique_ptr(BufferHelper::create(context.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; MockBuffer srcBuffer; std::unique_ptr dstBuffer; diff --git a/unit_tests/command_queue/enqueue_copy_buffer_tests.cpp b/unit_tests/command_queue/enqueue_copy_buffer_tests.cpp index 56c7ecc3bc..14bd94fd96 100644 --- a/unit_tests/command_queue/enqueue_copy_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_copy_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -307,12 +307,12 @@ struct EnqueueCopyBufferHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); dstBuffer = std::unique_ptr(BufferHelper<>::create(context.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr dstBuffer; MockBuffer srcBuffer; diff --git a/unit_tests/command_queue/enqueue_copy_buffer_to_image_fixture.h b/unit_tests/command_queue/enqueue_copy_buffer_to_image_fixture.h index 8b758e059d..3e6386c639 100644 --- a/unit_tests/command_queue/enqueue_copy_buffer_to_image_fixture.h +++ b/unit_tests/command_queue/enqueue_copy_buffer_to_image_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,8 +26,8 @@ struct EnqueueCopyBufferToImageTest : public CommandEnqueueFixture, virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - BufferDefaults::context = new MockContext(pDevice); - context = new MockContext(pDevice); + BufferDefaults::context = new MockContext(pClDevice); + context = new MockContext(pClDevice); srcBuffer = BufferHelper<>::create(context); dstImage = Image2dHelper<>::create(context); } @@ -65,8 +65,8 @@ struct EnqueueCopyBufferToImageMipMapTest : public CommandEnqueueFixture, virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - BufferDefaults::context = new MockContext(pDevice); - context = new MockContext(pDevice); + BufferDefaults::context = new MockContext(pClDevice); + context = new MockContext(pClDevice); srcBuffer = BufferHelper<>::create(context); } diff --git a/unit_tests/command_queue/enqueue_copy_buffer_to_image_tests.cpp b/unit_tests/command_queue/enqueue_copy_buffer_to_image_tests.cpp index 0077c4b101..aabd10872a 100644 --- a/unit_tests/command_queue/enqueue_copy_buffer_to_image_tests.cpp +++ b/unit_tests/command_queue/enqueue_copy_buffer_to_image_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -280,12 +280,12 @@ struct EnqueueCopyBufferToImageHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context = std::make_unique(device.get()); dstImage = std::unique_ptr(Image2dHelper<>::create(context.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr dstImage; MockBuffer srcBuffer; diff --git a/unit_tests/command_queue/enqueue_copy_image_fixture.h b/unit_tests/command_queue/enqueue_copy_image_fixture.h index fa0255bbee..bc96421a92 100644 --- a/unit_tests/command_queue/enqueue_copy_image_fixture.h +++ b/unit_tests/command_queue/enqueue_copy_image_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,7 +25,7 @@ struct EnqueueCopyImageTest : public CommandEnqueueFixture, virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); srcImage = Image2dHelper<>::create(context); dstImage = Image2dHelper<>::create(context); } @@ -59,7 +59,7 @@ struct EnqueueCopyImageMipMapTest : public CommandEnqueueFixture, void SetUp(void) override { CommandEnqueueFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); } virtual void TearDown(void) override { diff --git a/unit_tests/command_queue/enqueue_copy_image_to_buffer_fixture.h b/unit_tests/command_queue/enqueue_copy_image_to_buffer_fixture.h index 5ad986644c..d1a40d1611 100644 --- a/unit_tests/command_queue/enqueue_copy_image_to_buffer_fixture.h +++ b/unit_tests/command_queue/enqueue_copy_image_to_buffer_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,8 +25,8 @@ struct EnqueueCopyImageToBufferTest : public CommandEnqueueFixture, virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - BufferDefaults::context = new MockContext(pDevice); - context = new MockContext(pDevice); + BufferDefaults::context = new MockContext(pClDevice); + context = new MockContext(pClDevice); srcImage = Image2dHelper<>::create(context); dstBuffer = BufferHelper<>::create(context); } @@ -64,8 +64,8 @@ struct EnqueueCopyImageToBufferMipMapTest : public CommandEnqueueFixture, virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - BufferDefaults::context = new MockContext(pDevice); - context = new MockContext(pDevice); + BufferDefaults::context = new MockContext(pClDevice); + context = new MockContext(pClDevice); dstBuffer = BufferHelper<>::create(context); } diff --git a/unit_tests/command_queue/enqueue_copy_image_to_buffer_tests.cpp b/unit_tests/command_queue/enqueue_copy_image_to_buffer_tests.cpp index 018764c0fa..9421ebe4a9 100644 --- a/unit_tests/command_queue/enqueue_copy_image_to_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_copy_image_to_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -280,12 +280,12 @@ struct EnqueueCopyImageToBufferHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context = std::make_unique(device.get()); srcImage = std::unique_ptr(Image2dHelper<>::create(context.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr srcImage; MockBuffer dstBuffer; diff --git a/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp b/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp index cce63cc32b..ebdcb146fd 100644 --- a/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp +++ b/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp @@ -31,7 +31,7 @@ class EnqueueDebugKernelTest : public ProgramSimpleFixture, public: void SetUp() override { ProgramSimpleFixture::SetUp(); - device = pDevice; + device = pClDevice; pDevice->executionEnvironment->sourceLevelDebugger.reset(new SourceLevelDebugger(nullptr)); if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) { @@ -91,7 +91,7 @@ HWTEST_F(EnqueueDebugKernelTest, givenDebugKernelWhenEnqueuedThenSSHAndBtiAreCor if (pDevice->isSourceLevelDebuggerActive()) { using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE; using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; - std::unique_ptr> mockCmdQ(new MockCommandQueueHw(&context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new MockCommandQueueHw(&context, pClDevice, 0)); size_t gws[] = {1, 1, 1}; auto &ssh = mockCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 4096u); @@ -117,7 +117,7 @@ class GMockCommandQueueHw : public CommandQueueHw { typedef CommandQueueHw BaseClass; public: - GMockCommandQueueHw(Context *context, Device *device, cl_queue_properties *properties) : BaseClass(context, device, properties) { + GMockCommandQueueHw(Context *context, ClDevice *device, cl_queue_properties *properties) : BaseClass(context, device, properties) { } MOCK_METHOD1(setupDebugSurface, bool(Kernel *kernel)); @@ -128,7 +128,7 @@ HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithDebugEnabledWhe program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*pDevice, &program)); kernel->setContext(context); - std::unique_ptr> mockCmdQ(new GMockCommandQueueHw(context, pDevice, 0)); + std::unique_ptr> mockCmdQ(new GMockCommandQueueHw(context, pClDevice, 0)); EXPECT_CALL(*mockCmdQ.get(), setupDebugSurface(kernel.get())).Times(1).RetiresOnSaturation(); @@ -142,7 +142,7 @@ HWTEST_F(EnqueueDebugKernelSimpleTest, givenKernelFromProgramWithoutDebugEnabled MockProgram program(*pDevice->getExecutionEnvironment()); std::unique_ptr kernel(MockKernel::create(*pDevice, &program)); kernel->setContext(context); - std::unique_ptr>> mockCmdQ(new NiceMock>(context, pDevice, nullptr)); + std::unique_ptr>> mockCmdQ(new NiceMock>(context, pClDevice, nullptr)); EXPECT_CALL(*mockCmdQ.get(), setupDebugSurface(kernel.get())).Times(0); diff --git a/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp b/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp index c66a9467c6..4506195b9f 100644 --- a/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp @@ -543,11 +543,11 @@ struct EnqueueFillBufferHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; const uint8_t pattern[1] = {0x55}; const size_t patternSize = sizeof(pattern); diff --git a/unit_tests/command_queue/enqueue_fill_image_fixture.h b/unit_tests/command_queue/enqueue_fill_image_fixture.h index 0d80ef6a75..a2e5d88a27 100644 --- a/unit_tests/command_queue/enqueue_fill_image_fixture.h +++ b/unit_tests/command_queue/enqueue_fill_image_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,7 +21,7 @@ struct EnqueueFillImageTestFixture : public CommandEnqueueFixture { virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); image = Image2dHelper<>::create(context); } diff --git a/unit_tests/command_queue/enqueue_handler_tests.cpp b/unit_tests/command_queue/enqueue_handler_tests.cpp index 9501586ede..a0f1be1586 100644 --- a/unit_tests/command_queue/enqueue_handler_tests.cpp +++ b/unit_tests/command_queue/enqueue_handler_tests.cpp @@ -30,8 +30,8 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueingHandlerWithKernelThenProcessEvictionOnC auto csr = new MockCsrBase(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(csr); - MockKernelWithInternals mockKernel(*pDevice); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + MockKernelWithInternals mockKernel(*pClDevice); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); size_t gws[] = {1, 1, 1}; mockCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -44,8 +44,8 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWithKernelWhenAubCsrIsActiveThen auto aubCsr = new MockCsrAub(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(aubCsr); - MockKernelWithInternals mockKernel(*pDevice); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + MockKernelWithInternals mockKernel(*pClDevice); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); size_t gws[] = {1, 1, 1}; mockKernel.kernelInfo.name = "kernel_name"; @@ -62,12 +62,12 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWithKernelSplitWhenAubCsrIsActiv auto aubCsr = new MockCsrAub(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(aubCsr); - MockKernelWithInternals kernel1(*pDevice); - MockKernelWithInternals kernel2(*pDevice); + MockKernelWithInternals kernel1(*pClDevice); + MockKernelWithInternals kernel2(*pClDevice); kernel1.kernelInfo.name = "kernel_1"; kernel2.kernelInfo.name = "kernel_2"; - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel1.mockKernel, kernel2.mockKernel})); mockCmdQ->template enqueueHandler(nullptr, 0, true, multiDispatchInfo, 0, nullptr, nullptr); @@ -84,8 +84,8 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWithEmptyDispatchInfoWhenAubCsrI auto aubCsr = new MockCsrAub(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(aubCsr); - MockKernelWithInternals mockKernel(*pDevice); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + MockKernelWithInternals mockKernel(*pClDevice); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); size_t gws[] = {0, 0, 0}; mockKernel.kernelInfo.name = "kernel_name"; @@ -98,7 +98,7 @@ struct EnqueueHandlerWithAubSubCaptureTests : public EnqueueHandlerTest { template class MockCmdQWithAubSubCapture : public CommandQueueHw { public: - MockCmdQWithAubSubCapture(Context *context, Device *device) : CommandQueueHw(context, device, nullptr) {} + MockCmdQWithAubSubCapture(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr) {} void waitUntilComplete(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) override { waitUntilCompleteCalled = true; @@ -128,8 +128,8 @@ HWTEST_F(EnqueueHandlerWithAubSubCaptureTests, givenEnqueueHandlerWithAubSubCapt auto subCaptureManagerMock = new AubSubCaptureManagerMock("file_name.aub", subCaptureCommon); aubCsr->subCaptureManager.reset(subCaptureManagerMock); - MockCmdQWithAubSubCapture cmdQ(context, pDevice); - MockKernelWithInternals mockKernel(*pDevice); + MockCmdQWithAubSubCapture cmdQ(context, pClDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -152,8 +152,8 @@ HWTEST_F(EnqueueHandlerWithAubSubCaptureTests, givenEnqueueHandlerWithAubSubCapt auto subCaptureManagerMock = new AubSubCaptureManagerMock("file_name.aub", subCaptureCommon); aubCsr->subCaptureManager.reset(subCaptureManagerMock); - MockCmdQWithAubSubCapture cmdQ(context, pDevice); - MockKernelWithInternals mockKernel(*pDevice); + MockCmdQWithAubSubCapture cmdQ(context, pClDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; // activate subcapture @@ -174,7 +174,7 @@ class MyCommandQueueHw : public CommandQueueHw { typedef CommandQueueHw BaseClass; public: - MyCommandQueueHw(Context *context, Device *device, cl_queue_properties *properties) : BaseClass(context, device, properties){}; + MyCommandQueueHw(Context *context, ClDevice *device, cl_queue_properties *properties) : BaseClass(context, device, properties){}; Vec3 lws = {1, 1, 1}; Vec3 elws = {1, 1, 1}; void enqueueHandlerHook(const unsigned int commandType, const MultiDispatchInfo &multiDispatchInfo) override { @@ -187,10 +187,10 @@ HWTEST_F(EnqueueHandlerTest, givenLocalWorkgroupSizeGreaterThenGlobalWorkgroupSi int32_t tag; auto csr = new MockCsrBase(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(csr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto mockProgram = mockKernel.mockProgram; mockProgram->setAllowNonUniform(true); - MyCommandQueueHw myCmdQ(context, pDevice, 0); + MyCommandQueueHw myCmdQ(context, pClDevice, 0); size_t lws1d[] = {4, 1, 1}; size_t gws1d[] = {2, 1, 1}; @@ -221,10 +221,10 @@ HWTEST_F(EnqueueHandlerTest, givenLocalWorkgroupSizeGreaterThenGlobalWorkgroupSi int32_t tag; auto csr = new MockCsrBase(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(csr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto mockProgram = mockKernel.mockProgram; mockProgram->setAllowNonUniform(false); - MyCommandQueueHw myCmdQ(context, pDevice, 0); + MyCommandQueueHw myCmdQ(context, pClDevice, 0); size_t lws1d[] = {4, 1, 1}; size_t gws1d[] = {2, 1, 1}; @@ -237,7 +237,7 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingHandlerCallOnEnqueueMarkerThenCallProc auto csr = new MockCsrBase(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(csr); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); mockCmdQ->enqueueMarkerWithWaitList( 0, @@ -254,7 +254,7 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingHandlerForMarkerOnUnblockedQueueThenTa auto csr = new MockCsrBase(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(csr); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); // put queue into initial unblocked state mockCmdQ->taskLevel = 0; @@ -272,7 +272,7 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingHandlerForMarkerOnBlockedQueueThenTask auto csr = new MockCsrBase(tag, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(csr); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); // put queue into initial blocked state mockCmdQ->taskLevel = Event::eventNotReady; @@ -287,13 +287,13 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingHandlerForMarkerOnBlockedQueueThenTask HWTEST_F(EnqueueHandlerTest, WhenEnqueuingBlockedWithoutReturnEventThenVirtualEventIsCreatedAndCommandQueueInternalRefCountIsIncremeted) { - MockKernelWithInternals kernelInternals(*pDevice, context); + MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); // put queue into initial blocked state mockCmdQ->taskLevel = Event::eventNotReady; @@ -321,13 +321,13 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingBlockedWithoutReturnEventThenVirtualEv HWTEST_F(EnqueueHandlerTest, WhenEnqueuingBlockedThenVirtualEventIsSetAsCurrentCmdQVirtualEvent) { - MockKernelWithInternals kernelInternals(*pDevice, context); + MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); // put queue into initial blocked state mockCmdQ->taskLevel = Event::eventNotReady; @@ -349,12 +349,12 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingBlockedThenVirtualEventIsSetAsCurrentC } HWTEST_F(EnqueueHandlerTest, WhenEnqueuingWithOutputEventThenEventIsRegistered) { - MockKernelWithInternals kernelInternals(*pDevice, context); + MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); cl_event outputEvent = nullptr; - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); bool blocking = false; mockCmdQ->template enqueueHandler(nullptr, @@ -378,8 +378,8 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenAddPatchInfoCommentsForAUBDu csr->overwriteFlatBatchBufferHelper(mockHelper); pDevice->resetCommandStreamReceiver(csr); - MockKernelWithInternals mockKernel(*pDevice); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + MockKernelWithInternals mockKernel(*pClDevice); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); size_t gws[] = {1, 1, 1}; @@ -400,8 +400,8 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenAddPatchInfoCommentsForAUBDu csr->overwriteFlatBatchBufferHelper(mockHelper); pDevice->resetCommandStreamReceiver(csr); - MockKernelWithInternals mockKernel(*pDevice); - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pDevice, 0)); + MockKernelWithInternals mockKernel(*pClDevice); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); size_t gws[] = {1, 1, 1}; @@ -425,7 +425,7 @@ HWTEST_F(EnqueueHandlerTest, givenExternallySynchronizedParentEventWhenRequestin } }; - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); ExternallySynchEvent synchEvent(mockCmdQ); cl_event inEv = &synchEvent; @@ -452,11 +452,11 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenSubCaptureIsOffThenActivateS DebugManagerStateRestore stateRestore; DebugManager.flags.AUBDumpSubCaptureMode.set(static_cast(AubSubCaptureManager::SubCaptureMode::Off)); - MockKernelWithInternals kernelInternals(*pDevice, context); + MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); mockCmdQ->template enqueueHandler(nullptr, 0, @@ -474,11 +474,11 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenSubCaptureIsOnThenActivateSu DebugManagerStateRestore stateRestore; DebugManager.flags.AUBDumpSubCaptureMode.set(static_cast(AubSubCaptureManager::SubCaptureMode::Filter)); - MockKernelWithInternals kernelInternals(*pDevice, context); + MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); mockCmdQ->template enqueueHandler(nullptr, 0, @@ -496,7 +496,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenClSetKernelExecInfoAlreadyse DebugManagerStateRestore stateRestore; DebugManager.flags.AUBDumpSubCaptureMode.set(static_cast(AubSubCaptureManager::SubCaptureMode::Filter)); - MockKernelWithInternals kernelInternals(*pDevice, context); + MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -508,7 +508,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenClSetKernelExecInfoAlreadyse ptrSizeInBytes, // size_t param_value_size &euThreadSetting // const void *param_value ); - auto mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); mockCmdQ->template enqueueHandler(nullptr, 0, @@ -527,7 +527,7 @@ struct EnqueueHandlerTestBasic : public ::testing::Test { std::unique_ptr> setupFixtureAndCreateMockCommandQueue() { auto executionEnvironment = platformImpl->peekExecutionEnvironment(); - device.reset(MockDevice::createWithExecutionEnvironment(nullptr, executionEnvironment, 0u)); + device = std::make_unique(MockDevice::createWithExecutionEnvironment(nullptr, executionEnvironment, 0u)); context = std::make_unique(device.get()); auto mockCmdQ = std::make_unique>(context.get(), device.get(), nullptr); @@ -543,7 +543,7 @@ struct EnqueueHandlerTestBasic : public ::testing::Test { MockInternalAllocationStorage *mockInternalAllocationStorage = nullptr; const uint32_t initialTaskCount = 100; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; }; diff --git a/unit_tests/command_queue/enqueue_kernel_1_tests.cpp b/unit_tests/command_queue/enqueue_kernel_1_tests.cpp index 6276b72066..7a6c2008aa 100644 --- a/unit_tests/command_queue/enqueue_kernel_1_tests.cpp +++ b/unit_tests/command_queue/enqueue_kernel_1_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -41,7 +41,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDRangeKernel size_t globalWorkSize[3] = {n, 1, 1}; size_t localWorkSize[3] = {256, 1, 1}; cl_int retVal = CL_SUCCESS; - CommandQueue *pCmdQ2 = createCommandQueue(pDevice); + CommandQueue *pCmdQ2 = createCommandQueue(pClDevice); std::unique_ptr kernel(Kernel::create(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -80,7 +80,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenNotAllArgsAreSetButSetKernelArgIsCalled size_t globalWorkSize[3] = {n, 1, 1}; size_t localWorkSize[3] = {256, 1, 1}; cl_int retVal = CL_SUCCESS; - CommandQueue *pCmdQ2 = createCommandQueue(pDevice); + CommandQueue *pCmdQ2 = createCommandQueue(pClDevice); std::unique_ptr kernel(Kernel::create(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -119,7 +119,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenSetKernelArgIsCalledForEachArgButAtLeas size_t globalWorkSize[3] = {n, 1, 1}; size_t localWorkSize[3] = {256, 1, 1}; cl_int retVal = CL_SUCCESS; - CommandQueue *pCmdQ2 = createCommandQueue(pDevice); + CommandQueue *pCmdQ2 = createCommandQueue(pClDevice); std::unique_ptr kernel(Kernel::create(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -209,7 +209,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDRangeKernel size_t workgroupCount[3] = {2, 1, 1}; size_t localWorkSize[3] = {256, 1, 1}; cl_int retVal = CL_SUCCESS; - CommandQueue *pCmdQ2 = createCommandQueue(pDevice); + CommandQueue *pCmdQ2 = createCommandQueue(pClDevice); std::unique_ptr kernel(Kernel::create(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -248,7 +248,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenNotAllArgsAreSetButSetKernelArgIsCalled size_t workgroupCount[3] = {2, 1, 1}; size_t localWorkSize[3] = {256, 1, 1}; cl_int retVal = CL_SUCCESS; - CommandQueue *pCmdQ2 = createCommandQueue(pDevice); + CommandQueue *pCmdQ2 = createCommandQueue(pClDevice); std::unique_ptr kernel(Kernel::create(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -287,7 +287,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenSetKernelArgIsCalledForEachArgButAtLeas size_t workgroupCount[3] = {2, 1, 1}; size_t localWorkSize[3] = {256, 1, 1}; cl_int retVal = CL_SUCCESS; - CommandQueue *pCmdQ2 = createCommandQueue(pDevice); + CommandQueue *pCmdQ2 = createCommandQueue(pClDevice); std::unique_ptr kernel(Kernel::create(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -406,7 +406,7 @@ TEST_F(EnqueueKernelTest, GivenKernelWithBuiltinDispatchInfoBuilderWhenBeingDisp MockBuiltinDispatchBuilder mockNuiltinDispatchBuilder(*pCmdQ->getDevice().getExecutionEnvironment()->getBuiltIns()); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.builtinDispatchBuilder = &mockNuiltinDispatchBuilder; EXPECT_FALSE(mockNuiltinDispatchBuilder.wasValidateDispatchCalled); @@ -456,7 +456,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueKernelTest, givenSecondEnqueueWithTheSameScra mediaVFEstate.PerThreadScratchSpace = scratchSize; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.patchInfo.mediavfestate = &mediaVFEstate; auto sizeToProgram = Kernel::getScratchSizeValueToProgramMediaVfeState(scratchSize); @@ -497,7 +497,7 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueingKernelThatRequirePrivateScratchThenPri mediaVFEstate.PerThreadScratchSpace = privateScratchSize; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.patchInfo.mediaVfeStateSlot1 = &mediaVFEstate; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr); @@ -510,7 +510,7 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueKernelWithNoStatelessWriteWhenSbaIsBeingP size_t off[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.mockKernel->containsStatelessWrites = false; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr); @@ -530,7 +530,7 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueKernelWithNoStatelessWriteOnBlockedCodePa auto userEvent = clCreateUserEvent(this->context, nullptr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.mockKernel->containsStatelessWrites = false; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 1, &userEvent, nullptr); @@ -549,7 +549,7 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueKernelWithNoStatelessWriteOnBlockedCodePa HWTEST_F(EnqueueKernelTest, givenEnqueueWithGlobalWorkSizeWhenZeroValueIsPassedInDimensionThenTheKernelCommandWillTriviallySucceed) { size_t gws[3] = {0, 0, 0}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto ret = pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); auto expected = (pDevice->getEnabledClVersion() < 21 ? CL_INVALID_GLOBAL_WORK_SIZE : CL_SUCCESS); EXPECT_EQ(expected, ret); @@ -563,7 +563,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenEnqueueK auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; auto ret = pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); EXPECT_EQ(CL_SUCCESS, ret); @@ -580,11 +580,11 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenEnqueueK } HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtrWithL3FlushRequiredWhenEnqueueKernelIsCalledThenFlushIsCalledForReducedAddressSpacePlatforms) { - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr cmdQ; auto hwInfoToModify = *platformDevices[0]; hwInfoToModify.capabilityTable.gpuAddressSpace = MemoryConstants::max36BitAddress; - device.reset(MockDevice::createWithNewExecutionEnvironment(&hwInfoToModify)); + device.reset(new MockClDevice{MockDevice::createWithNewExecutionEnvironment(&hwInfoToModify)}); auto mockCsr = new MockCsrHw2(*device->executionEnvironment, device->getRootDeviceIndex()); device->resetCommandStreamReceiver(mockCsr); auto memoryManager = mockCsr->getMemoryManager(); @@ -604,11 +604,11 @@ HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtr } HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtrWithL3FlushUnrequiredWhenEnqueueKernelIsCalledThenFlushIsNotForcedByGraphicsAllocation) { - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr cmdQ; auto hwInfoToModify = *platformDevices[0]; hwInfoToModify.capabilityTable.gpuAddressSpace = MemoryConstants::max36BitAddress; - device.reset(MockDevice::createWithNewExecutionEnvironment(&hwInfoToModify)); + device.reset(new MockClDevice{MockDevice::createWithNewExecutionEnvironment(&hwInfoToModify)}); auto mockCsr = new MockCsrHw2(*device->executionEnvironment, device->getRootDeviceIndex()); device->resetCommandStreamReceiver(mockCsr); auto memoryManager = mockCsr->getMemoryManager(); @@ -629,11 +629,11 @@ HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtr HWTEST_F(EnqueueKernelTest, givenFullAddressSpaceGraphicsAllocationWhenEnqueueKernelIsCalledThenFlushIsNotForcedByGraphicsAllocation) { HardwareInfo hwInfoToModify; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr cmdQ; hwInfoToModify = *platformDevices[0]; hwInfoToModify.capabilityTable.gpuAddressSpace = MemoryConstants::max48BitAddress; - device.reset(MockDevice::createWithNewExecutionEnvironment(&hwInfoToModify)); + device.reset(new MockClDevice{MockDevice::createWithNewExecutionEnvironment(&hwInfoToModify)}); auto mockCsr = new MockCsrHw2(*device->executionEnvironment, device->getRootDeviceIndex()); device->resetCommandStreamReceiver(mockCsr); auto memoryManager = mockCsr->getMemoryManager(); @@ -662,7 +662,7 @@ HWTEST_F(EnqueueKernelTest, givenFullAddressSpaceGraphicsAllocationWhenEnqueueKe } HWTEST_F(EnqueueKernelTest, givenDefaultCommandStreamReceiverWhenClFlushIsCalledThenSuccessIsReturned) { - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); auto ret = clFlush(pCmdQ); @@ -677,7 +677,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeAndBatchedKe auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsrmockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -698,7 +698,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeAndBatchedKe auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsrmockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); auto ret = clFlush(pCmdQ); @@ -716,7 +716,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenKernelIs auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsrmockCsr.submissionAggregator.reset(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; //make sure csr emits something mockCsrmockCsr.mediaVfeStateDirty = true; @@ -745,7 +745,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenFlushIsC auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -763,7 +763,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledThenBatchesS auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -782,7 +782,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenThressEnqueueKernelsAreCal auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -802,7 +802,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenWaitForEventsIsCalledThenB auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); cl_event event; @@ -826,7 +826,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenCommandIsFlushedThenFlushS auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); cl_event event; @@ -856,7 +856,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenNonBlockingMapFollowsNdrCa pDevice->resetCommandStreamReceiver(mockCsr); EXPECT_TRUE(this->destBuffer->isMemObjZeroCopy()); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); cl_event event; @@ -876,7 +876,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenCommandWithEventIsFollowed auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; cl_event event; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, &event); @@ -905,7 +905,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenClFlushIsCalledThenQueueFl mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -925,7 +925,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenWaitForEventsIsCalledWithU auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; cl_event event; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -949,7 +949,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledWithUnflushe auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; cl_event event; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -967,7 +967,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledWithUnflushe HWTEST_F(EnqueueKernelTest, givenOutOfOrderCommandQueueWhenEnqueueKernelIsMadeThenPipeControlPositionIsRecorded) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0}; - auto ooq = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr); + auto ooq = clCreateCommandQueueWithProperties(context, pClDevice, props, nullptr); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); @@ -976,7 +976,7 @@ HWTEST_F(EnqueueKernelTest, givenOutOfOrderCommandQueueWhenEnqueueKernelIsMadeTh auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; clEnqueueNDRangeKernel(ooq, mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -989,14 +989,14 @@ HWTEST_F(EnqueueKernelTest, givenOutOfOrderCommandQueueWhenEnqueueKernelIsMadeTh HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelIsMadeThenPipeControlPositionIsRecorded) { const cl_queue_properties props[] = {0}; - auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr); + auto inOrderQueue = clCreateCommandQueueWithProperties(context, pClDevice, props, nullptr); auto &mockCsr = pDevice->getUltCommandStreamReceiver(); mockCsr.overrideDispatchPolicy(DispatchMode::BatchedDispatch); auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr.submissionAggregator.reset(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; clEnqueueNDRangeKernel(inOrderQueue, mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -1009,7 +1009,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelIsMadeThenP HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelThatHasSharedObjectsAsArgIsMadeThenPipeControlPositionIsRecorded) { const cl_queue_properties props[] = {0}; - auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr); + auto inOrderQueue = clCreateCommandQueueWithProperties(context, pClDevice, props, nullptr); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); @@ -1018,7 +1018,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelThatHasShar auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; mockKernel.mockKernel->setUsingSharedArgs(true); clEnqueueNDRangeKernel(inOrderQueue, mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -1036,7 +1036,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelThatHasShar mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; mockKernel.mockKernel->setUsingSharedArgs(true); clEnqueueNDRangeKernel(this->pCmdQ, mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -1046,7 +1046,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelThatHasShar HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEventIsMadeThenPipeControlPositionIsNotRecorded) { const cl_queue_properties props[] = {0}; - auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr); + auto inOrderQueue = clCreateCommandQueueWithProperties(context, pClDevice, props, nullptr); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); @@ -1056,7 +1056,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEv auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; cl_event event; @@ -1073,7 +1073,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEv HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEventIsMadeAndCommandStreamReceiverIsInNTo1ModeThenPipeControlPositionIsRecorded) { const cl_queue_properties props[] = {0}; - auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr); + auto inOrderQueue = clCreateCommandQueueWithProperties(context, pClDevice, props, nullptr); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); @@ -1083,7 +1083,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEv auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; cl_event event; @@ -1107,9 +1107,9 @@ HWTEST_F(EnqueueKernelTest, givenOutOfOrderCommandQueueWhenEnqueueKernelReturnin mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0}; - auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr); + auto inOrderQueue = clCreateCommandQueueWithProperties(context, pClDevice, props, nullptr); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; cl_event event; @@ -1131,7 +1131,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenBlockingCallIsMadeThenEven mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; cl_event event; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, &event); @@ -1147,7 +1147,7 @@ HWTEST_F(EnqueueKernelTest, givenKernelWhenItIsEnqueuedThenAllResourceGraphicsAl auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -1162,14 +1162,14 @@ HWTEST_F(EnqueueKernelTest, givenKernelWhenItIsEnqueuedThenAllResourceGraphicsAl HWTEST_F(EnqueueKernelTest, givenKernelWhenItIsSubmittedFromTwoDifferentCommandQueuesThenCsrDoesntReloadAnyCommands) { auto &csr = this->pDevice->getUltCommandStreamReceiver(); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); auto currentUsed = csr.commandStream.getUsed(); const cl_queue_properties props[] = {0}; - auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr); + auto inOrderQueue = clCreateCommandQueueWithProperties(context, pClDevice, props, nullptr); clEnqueueNDRangeKernel(inOrderQueue, mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); auto usedAfterSubmission = csr.commandStream.getUsed(); @@ -1183,7 +1183,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreNotAndEventExistSetThenClEnqu size_t globalWorkSize[3] = {n, 1, 1}; size_t localWorkSize[3] = {256, 1, 1}; cl_int retVal = CL_SUCCESS; - CommandQueue *pCmdQ2 = createCommandQueue(pDevice); + CommandQueue *pCmdQ2 = createCommandQueue(pClDevice); std::unique_ptr kernel(Kernel::create(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -1198,7 +1198,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreNotAndEventExistSetThenClEnqu } TEST_F(EnqueueKernelTest, givenEnqueueCommandThatLwsExceedsDeviceCapabilitiesWhenEnqueueNDRangeKernelIsCalledThenErrorIsReturned) { - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.mockKernel->maxKernelWorkGroupSize = static_cast(pDevice->getDeviceInfo().maxWorkGroupSize / 2); @@ -1213,7 +1213,7 @@ TEST_F(EnqueueKernelTest, givenEnqueueCommandThatLwsExceedsDeviceCapabilitiesWhe TEST_F(EnqueueKernelTest, givenEnqueueCommandThatLocalWorkgroupSizeContainsZeroWhenEnqueueNDRangeKernelIsCalledThenClInvalidWorkGroupSizeIsReturned) { size_t globalWorkSize[3] = {1, 1, 1}; size_t localWorkSize[3] = {1, 0, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto status = pCmdQ->enqueueKernel(mockKernel.mockKernel, 3, nullptr, globalWorkSize, localWorkSize, 0, nullptr, nullptr); EXPECT_EQ(CL_INVALID_WORK_GROUP_SIZE, status); @@ -1224,7 +1224,7 @@ HWTEST_F(EnqueueKernelTest, givenVMEKernelWhenEnqueueKernelThenDispatchFlagsHave mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; mockKernel.kernelInfo.isVmeWorkload = true; clEnqueueNDRangeKernel(this->pCmdQ, mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -1236,7 +1236,7 @@ HWTEST_F(EnqueueKernelTest, givenNonVMEKernelWhenEnqueueKernelThenDispatchFlagsD mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); pDevice->resetCommandStreamReceiver(mockCsr); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); size_t gws[3] = {1, 0, 0}; mockKernel.kernelInfo.isVmeWorkload = false; clEnqueueNDRangeKernel(this->pCmdQ, mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); @@ -1248,7 +1248,7 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueKernelWithEngineHintsThenEpilogRequiredIs size_t off[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); pCmdQ->dispatchHints = 1; pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr); diff --git a/unit_tests/command_queue/enqueue_kernel_2_tests.cpp b/unit_tests/command_queue/enqueue_kernel_2_tests.cpp index 031c5ff225..13bdd6083d 100644 --- a/unit_tests/command_queue/enqueue_kernel_2_tests.cpp +++ b/unit_tests/command_queue/enqueue_kernel_2_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -306,7 +306,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueScratchSpaceTests, GivenKernelRequiringScratc mediaVFEstate.PerThreadScratchSpace = scratchSize; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.patchInfo.mediavfestate = &mediaVFEstate; auto sizeToProgram = (scratchSize / MemoryConstants::kiloByte); @@ -441,7 +441,7 @@ HWTEST_P(EnqueueKernelWithScratch, GivenKernelRequiringScratchWhenItIsEnqueuedWi mediaVFEstate.PerThreadScratchSpace = scratchSize; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.patchInfo.mediavfestate = &mediaVFEstate; auto sizeToProgram = (scratchSize / MemoryConstants::kiloByte); @@ -483,7 +483,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueKernelWithScratch, givenDeviceForcing32bitAll auto scratchSize = 1024; mediaVFEstate.PerThreadScratchSpace = scratchSize; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.patchInfo.mediavfestate = &mediaVFEstate; enqueueKernel(mockKernel); @@ -539,7 +539,7 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfThenPatchCrossTHreadData) patchData.Size = 256; patchData.DataParamOffset = 64; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.crossThreadData[64] = 0; mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData; @@ -555,7 +555,7 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfWhenBeingDispatchedThenL3 patchData.Size = 256; patchData.DataParamOffset = 64; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.crossThreadData[64] = 0; mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData; auto &csr = pCmdQ->getGpgpuCommandStreamReceiver(); @@ -575,7 +575,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueKernelPrintfTest, GivenKernelWithPrintfBlocke patchData.Size = 256; patchData.DataParamOffset = 64; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.crossThreadData[64] = 0; mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData; auto &csr = pCmdQ->getGpgpuCommandStreamReceiver(); @@ -623,7 +623,7 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfBlockedByEventWhenEventUn patchData.DataParamSize = 8; patchData.DataParamOffset = 0; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData; auto crossThreadData = reinterpret_cast(mockKernel.mockKernel->getCrossThreadData()); @@ -675,7 +675,7 @@ struct EnqueueAuxKernelTests : public EnqueueKernelTest { using CommandQueueHw::commandStream; using CommandQueueHw::gpgpuEngine; using CommandQueueHw::bcsEngine; - MyCmdQ(Context *context, Device *device) : CommandQueueHw(context, device, nullptr) {} + MyCmdQ(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr) {} void dispatchAuxTranslationBuiltin(MultiDispatchInfo &multiDispatchInfo, AuxTranslationDirection auxTranslationDirection) override { CommandQueueHw::dispatchAuxTranslationBuiltin(multiDispatchInfo, auxTranslationDirection); auxTranslationDirections.push_back(auxTranslationDirection); @@ -708,8 +708,8 @@ struct EnqueueAuxKernelTests : public EnqueueKernelTest { }; HWTEST_F(EnqueueAuxKernelTests, givenKernelWithRequiredAuxTranslationAndWithoutArgumentsWhenEnqueuedThenNoGuardKernelWithAuxTranslations) { - MockKernelWithInternals mockKernel(*pDevice, context); - MyCmdQ cmdQ(context, pDevice); + MockKernelWithInternals mockKernel(*pClDevice, context); + MyCmdQ cmdQ(context, pClDevice); size_t gws[3] = {1, 0, 0}; mockKernel.mockKernel->auxTranslationRequired = true; @@ -722,7 +722,7 @@ HWTEST_F(EnqueueAuxKernelTests, givenMultipleArgsWhenAuxTranslationIsRequiredThe GTEST_SKIP(); } - MyCmdQ cmdQ(context, pDevice); + MyCmdQ cmdQ(context, pClDevice); size_t gws[3] = {1, 0, 0}; MockBuffer buffer0, buffer1, buffer2, buffer3; cl_mem clMem0 = &buffer0; @@ -734,7 +734,7 @@ HWTEST_F(EnqueueAuxKernelTests, givenMultipleArgsWhenAuxTranslationIsRequiredThe buffer2.getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); buffer3.getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); - MockKernelWithInternals mockKernel(*pDevice, context); + MockKernelWithInternals mockKernel(*pClDevice, context); mockKernel.mockKernel->auxTranslationRequired = true; mockKernel.kernelInfo.kernelArgInfo.resize(6); for (auto &kernelInfo : mockKernel.kernelInfo.kernelArgInfo) { @@ -783,8 +783,8 @@ HWTEST_F(EnqueueAuxKernelTests, givenMultipleArgsWhenAuxTranslationIsRequiredThe } HWTEST_F(EnqueueAuxKernelTests, givenKernelWithRequiredAuxTranslationWhenEnqueuedThenDispatchAuxTranslationBuiltin) { - MockKernelWithInternals mockKernel(*pDevice, context); - MyCmdQ cmdQ(context, pDevice); + MockKernelWithInternals mockKernel(*pClDevice, context); + MyCmdQ cmdQ(context, pClDevice); size_t gws[3] = {1, 0, 0}; MockBuffer buffer; cl_mem clMem = &buffer; @@ -817,8 +817,8 @@ HWTEST_F(EnqueueAuxKernelTests, givenDebugVariableDisablingBuiltinTranslationWhe DebugManager.flags.ForceAuxTranslationMode.set(static_cast(AuxTranslationMode::Blit)); pDevice->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; - MockKernelWithInternals mockKernel(*pDevice, context); - MyCmdQ cmdQ(context, pDevice); + MockKernelWithInternals mockKernel(*pClDevice, context); + MyCmdQ cmdQ(context, pClDevice); cmdQ.bcsEngine = cmdQ.gpgpuEngine; size_t gws[3] = {1, 0, 0}; @@ -852,8 +852,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueKernelTest, givenCacheFlushAfterWalkerEnabled DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - MockKernelWithInternals mockKernel(*pDevice, context); - CommandQueueHw cmdQ(context, pDevice, nullptr); + MockKernelWithInternals mockKernel(*pClDevice, context); + CommandQueueHw cmdQ(context, pClDevice, nullptr); size_t gws[3] = {1, 0, 0}; @@ -874,11 +874,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueKernelTest, givenCacheFlushAfterWalkerEnabled HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelWhenAuxTranslationIsRequiredThenMakeEnqueueBlocking) { if (pDevice->getSupportedClVersion() >= 20) { - MyCmdQ cmdQ(context, pDevice); + MyCmdQ cmdQ(context, pClDevice); size_t gws[3] = {1, 0, 0}; cl_queue_properties queueProperties = {}; - auto mockDevQueue = std::make_unique>(context, pDevice, queueProperties); + auto mockDevQueue = std::make_unique>(context, pClDevice, queueProperties); context->setDefaultDeviceQueue(mockDevQueue.get()); std::unique_ptr parentKernel(MockParentKernel::create(*context, false, false, false, false, false)); parentKernel->initialize(); @@ -896,7 +896,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelWhenAuxTrans HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelButNoDeviceQueueWhenEnqueueIsCalledItReturnsInvalidOperation) { if (pDevice->getSupportedClVersion() >= 20) { - MyCmdQ cmdQ(context, pDevice); + MyCmdQ cmdQ(context, pClDevice); size_t gws[3] = {1, 0, 0}; std::unique_ptr parentKernel(MockParentKernel::create(*context, false, false, false, false, false)); diff --git a/unit_tests/command_queue/enqueue_kernel_mt_tests.cpp b/unit_tests/command_queue/enqueue_kernel_mt_tests.cpp index 6b76253919..3719dae9b6 100644 --- a/unit_tests/command_queue/enqueue_kernel_mt_tests.cpp +++ b/unit_tests/command_queue/enqueue_kernel_mt_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,7 +24,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledThenBatchesS std::atomic startEnqueueProcess(false); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t gws[3] = {1, 0, 0}; auto enqueueCount = 10; diff --git a/unit_tests/command_queue/enqueue_kernel_two_ioq_tests.cpp b/unit_tests/command_queue/enqueue_kernel_two_ioq_tests.cpp index 566acb5477..b49cd7f058 100644 --- a/unit_tests/command_queue/enqueue_kernel_two_ioq_tests.cpp +++ b/unit_tests/command_queue/enqueue_kernel_two_ioq_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -58,7 +58,7 @@ struct TwoIOQsTwoDependentWalkers : public HelloWorldTest(*pCmdQ); // Create a second command queue (beyond the default one) - pCmdQ2 = createCommandQueue(pDevice); + pCmdQ2 = createCommandQueue(pClDevice); ASSERT_NE(nullptr, pCmdQ2); retVal = pCmdQ2->enqueueKernel( diff --git a/unit_tests/command_queue/enqueue_kernel_two_ooq_tests.cpp b/unit_tests/command_queue/enqueue_kernel_two_ooq_tests.cpp index c65dff99f3..2204aff8c9 100644 --- a/unit_tests/command_queue/enqueue_kernel_two_ooq_tests.cpp +++ b/unit_tests/command_queue/enqueue_kernel_two_ooq_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -61,7 +61,7 @@ struct TwoOOQsTwoDependentWalkers : public HelloWorldTest, ASSERT_EQ(CL_SUCCESS, retVal); // Create a second command queue (beyond the default one) - pCmdQ2 = createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); + pCmdQ2 = createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); ASSERT_NE(nullptr, pCmdQ2); retVal = pCmdQ2->enqueueKernel( diff --git a/unit_tests/command_queue/enqueue_map_buffer_tests.cpp b/unit_tests/command_queue/enqueue_map_buffer_tests.cpp index dfd09fe54c..66d71d3f7e 100644 --- a/unit_tests/command_queue/enqueue_map_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_map_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,7 +31,7 @@ struct EnqueueMapBufferTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(pDevice, 0); + CommandQueueFixture::SetUp(pClDevice, 0); BufferDefaults::context = new MockContext; buffer = BufferHelper>::create(); @@ -266,7 +266,7 @@ TEST_F(EnqueueMapBufferTest, givenNonBlockingReadOnlyMapBufferOnZeroCopyBufferWh cl_event mapEventReturned = nullptr; cl_event unmapEventReturned = nullptr; *pTagMemory = 0; - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); size_t GWS = 1; struct E2Clb { @@ -451,7 +451,7 @@ TEST_F(EnqueueMapBufferTest, givenNonBlockingMapBufferAfterL3IsAlreadyFlushedThe cl_event eventReturned = nullptr; uint32_t tagHW = 0; *pTagMemory = tagHW; - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); size_t GWS = 1; auto buffer = clCreateBuffer( @@ -518,7 +518,7 @@ TEST_F(EnqueueMapBufferTest, GivenBufferThatIsNotZeroCopyWhenNonBlockingMapIsCal const auto bufferSize = 100; auto localSize = bufferSize; char misaligned[bufferSize] = {1}; - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); size_t GWS = 1; uintptr_t address = (uintptr_t)&misaligned[0]; diff --git a/unit_tests/command_queue/enqueue_map_image_tests.cpp b/unit_tests/command_queue/enqueue_map_image_tests.cpp index 45fef5c47c..f7a41cd21e 100644 --- a/unit_tests/command_queue/enqueue_map_image_tests.cpp +++ b/unit_tests/command_queue/enqueue_map_image_tests.cpp @@ -31,8 +31,8 @@ struct EnqueueMapImageTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(pDevice, 0); - context = new MockContext(pDevice); + CommandQueueFixture::SetUp(pClDevice, 0); + context = new MockContext(pClDevice); image = ImageHelper>::create(context); } @@ -319,7 +319,7 @@ HWTEST_F(EnqueueMapImageTest, givenNonReadOnlyMapWithOutEventWhenMappedThenSetEv size_t imageSlicePitch = 0; size_t GWS = 1; - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); *pTagMemory = tagHW; auto &commandStreamReceiver = pCmdQ->getGpgpuCommandStreamReceiver(); auto tag_address = commandStreamReceiver.getTagAddress(); diff --git a/unit_tests/command_queue/enqueue_marker_tests.cpp b/unit_tests/command_queue/enqueue_marker_tests.cpp index 11164050cd..8ce18cd8dd 100644 --- a/unit_tests/command_queue/enqueue_marker_tests.cpp +++ b/unit_tests/command_queue/enqueue_marker_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -228,7 +228,7 @@ TEST_F(MarkerTest, givenMultipleEventsAndCompletedUserEventWhenTheyArePassedToMa } HWTEST_F(MarkerTest, givenMarkerCallFollowingNdrangeCallInBatchedModeWhenWaitForEventsIsCalledThenFlushStampIsProperlyUpdated) { - MockKernelWithInternals mockKernel(*this->pDevice, this->context); + MockKernelWithInternals mockKernel(*this->pClDevice, this->context); auto &ultCommandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); diff --git a/unit_tests/command_queue/enqueue_migrate_mem_objects_tests.cpp b/unit_tests/command_queue/enqueue_migrate_mem_objects_tests.cpp index 46da482482..3c9701b451 100644 --- a/unit_tests/command_queue/enqueue_migrate_mem_objects_tests.cpp +++ b/unit_tests/command_queue/enqueue_migrate_mem_objects_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,7 +21,7 @@ class MigrateMemObjectsFixture public: void SetUp() override { DeviceFixture::SetUp(); - CommandQueueHwFixture::SetUp(pDevice, 0); + CommandQueueHwFixture::SetUp(pClDevice, 0); ASSERT_NE(nullptr, pCmdQ); } diff --git a/unit_tests/command_queue/enqueue_read_buffer_event_tests.cpp b/unit_tests/command_queue/enqueue_read_buffer_event_tests.cpp index 7782a6ad33..df32c29533 100644 --- a/unit_tests/command_queue/enqueue_read_buffer_event_tests.cpp +++ b/unit_tests/command_queue/enqueue_read_buffer_event_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -176,7 +176,7 @@ TEST_F(EnqueueReadBuffer, givenInOrderQueueAndForcedCpuCopyOnReadBufferAndDstPtr TEST_F(EnqueueReadBuffer, givenOutOfOrderQueueAndForcedCpuCopyOnReadBufferAndDstPtrEqualSrcPtrWithEventsNotBlockedWhenReadBufferIsExecutedThenTaskLevelShouldNotBeIncreased) { DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnReadBuffer.set(true); - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); cl_int retVal = CL_SUCCESS; uint32_t taskLevelCmdQ = 17; pCmdOOQ->taskLevel = taskLevelCmdQ; @@ -300,7 +300,7 @@ TEST_F(EnqueueReadBuffer, givenInOrderQueueAndDisabledSupportCpuCopiesAndDstPtrE TEST_F(EnqueueReadBuffer, givenOutOfOrderQueueAndDisabledSupportCpuCopiesAndDstPtrEqualSrcPtrWithEventsWhenReadBufferIsExecutedThenTaskLevelShouldNotBeIncreased) { DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnReadBuffer.set(false); - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); cl_int retVal = CL_SUCCESS; uint32_t taskLevelCmdQ = 17; pCmdOOQ->taskLevel = taskLevelCmdQ; diff --git a/unit_tests/command_queue/enqueue_read_buffer_rect_fixture.h b/unit_tests/command_queue/enqueue_read_buffer_rect_fixture.h index 78c83f32fe..3509a53f81 100644 --- a/unit_tests/command_queue/enqueue_read_buffer_rect_fixture.h +++ b/unit_tests/command_queue/enqueue_read_buffer_rect_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,7 +26,7 @@ struct EnqueueReadBufferRectTest : public CommandEnqueueFixture, void SetUp() override { CommandEnqueueFixture::SetUp(); - context.reset(new MockContext(&pCmdQ->getDevice())); + context.reset(new MockContext(platform()->clDeviceMap[&pCmdQ->getDevice()])); BufferDefaults::context = context.get(); //For 3D diff --git a/unit_tests/command_queue/enqueue_read_buffer_rect_tests.cpp b/unit_tests/command_queue/enqueue_read_buffer_rect_tests.cpp index c12c4f1845..ae0eaeee2d 100644 --- a/unit_tests/command_queue/enqueue_read_buffer_rect_tests.cpp +++ b/unit_tests/command_queue/enqueue_read_buffer_rect_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -361,7 +361,7 @@ HWTEST_F(EnqueueReadBufferRectTest, givenInOrderQueueAndDstPtrEqualSrcPtrWithEve } HWTEST_F(EnqueueReadBufferRectTest, givenOutOfOrderQueueAndDstPtrEqualSrcPtrWithEventsWhenReadBufferIsExecutedThenTaskLevelShouldNotBeIncreased) { cl_int retVal = CL_SUCCESS; - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); uint32_t taskLevelCmdQ = 17; pCmdOOQ->taskLevel = taskLevelCmdQ; @@ -617,11 +617,11 @@ struct EnqueueReadBufferRectHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; MockBuffer srcBuffer; diff --git a/unit_tests/command_queue/enqueue_read_buffer_tests.cpp b/unit_tests/command_queue/enqueue_read_buffer_tests.cpp index b8ec08dd19..21ee9b0d05 100644 --- a/unit_tests/command_queue/enqueue_read_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_read_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -372,7 +372,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenOOQWithEnabledSupportCpuCopiesAndDstPtr DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnReadBuffer.set(true); cl_int retVal = CL_SUCCESS; - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); EXPECT_EQ(retVal, CL_SUCCESS); retVal = pCmdOOQ->enqueueReadBuffer(srcBuffer.get(), @@ -392,7 +392,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenOOQWithDisabledSupportCpuCopiesAndDstPt DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnReadBuffer.set(false); cl_int retVal = CL_SUCCESS; - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); EXPECT_EQ(retVal, CL_SUCCESS); retVal = pCmdOOQ->enqueueReadBuffer(srcBuffer.get(), @@ -486,7 +486,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenInOrderQueueAndEnabledSupportCpuCopiesA } HWTEST_F(EnqueueReadBufferTypeTest, givenCommandQueueWhenEnqueueReadBufferIsCalledThenItCallsNotifyFunction) { - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); auto retVal = mockCmdQ->enqueueReadBuffer(srcBuffer.get(), CL_TRUE, @@ -503,7 +503,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenCommandQueueWhenEnqueueReadBufferIsCall } HWTEST_F(EnqueueReadBufferTypeTest, givenCommandQueueWhenEnqueueReadBufferWithMapAllocationIsCalledThenItDoesntCallNotifyFunction) { - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); GraphicsAllocation mapAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; auto retVal = mockCmdQ->enqueueReadBuffer(srcBuffer.get(), @@ -529,7 +529,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenEnqueueReadBufferCalledWhenLockedPtrInT MockContext ctx; cl_int retVal; ctx.memoryManager = &memoryManager; - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); @@ -557,7 +557,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedB MockContext ctx; cl_int retVal; ctx.memoryManager = &memoryManager; - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); @@ -603,7 +603,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, gicenEnqueueReadBufferCalledWhenLockedPtrInT MockContext ctx; cl_int retVal; ctx.memoryManager = &memoryManager; - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::System4KBPages); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); @@ -689,11 +689,11 @@ struct EnqueueReadBufferHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; MockBuffer srcBuffer; uint64_t bigSize = 4ull * MemoryConstants::gigaByte; diff --git a/unit_tests/command_queue/enqueue_read_image_fixture.h b/unit_tests/command_queue/enqueue_read_image_fixture.h index 054b45ab24..116b4ceb70 100644 --- a/unit_tests/command_queue/enqueue_read_image_fixture.h +++ b/unit_tests/command_queue/enqueue_read_image_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -28,7 +28,7 @@ struct EnqueueReadImageTest : public CommandEnqueueFixture, virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); srcImage = Image2dHelper<>::create(context); const auto &imageDesc = srcImage->getImageDesc(); dstPtr = new float[imageDesc.image_width * imageDesc.image_height]; diff --git a/unit_tests/command_queue/enqueue_read_image_tests.cpp b/unit_tests/command_queue/enqueue_read_image_tests.cpp index 77bca504cd..b5bb37f983 100644 --- a/unit_tests/command_queue/enqueue_read_image_tests.cpp +++ b/unit_tests/command_queue/enqueue_read_image_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -304,7 +304,7 @@ HWTEST_F(EnqueueReadImageTest, GivenImage1DAndImageShareTheSameStorageWithHostPt cl_int retVal = CL_SUCCESS; std::unique_ptr dstImage2(Image1dHelper<>::create(context)); auto imageDesc = dstImage2->getImageDesc(); - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); size_t origin[] = {0, 0, 0}; size_t region[] = {imageDesc.image_width, 1, 1}; void *ptr = dstImage2->getCpuAddressForMemoryTransfer(); @@ -428,7 +428,7 @@ HWTEST_F(EnqueueReadImageTest, GivenImage1DThatIsZeroCopyWhenReadImageWithTheSam } HWTEST_F(EnqueueReadImageTest, givenCommandQueueWhenEnqueueReadImageIsCalledThenItCallsNotifyFunction) { - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr srcImage(Image2dArrayHelper<>::create(context)); auto imageDesc = srcImage->getImageDesc(); size_t origin[] = {0, 0, 0}; @@ -440,7 +440,7 @@ HWTEST_F(EnqueueReadImageTest, givenCommandQueueWhenEnqueueReadImageIsCalledThen } HWTEST_F(EnqueueReadImageTest, givenCommandQueueWhenEnqueueReadImageWithMapAllocationIsCalledThenItDoesntCallNotifyFunction) { - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr srcImage(Image2dArrayHelper<>::create(context)); auto imageDesc = srcImage->getImageDesc(); size_t origin[] = {0, 0, 0}; diff --git a/unit_tests/command_queue/enqueue_svm_mem_copy_tests.cpp b/unit_tests/command_queue/enqueue_svm_mem_copy_tests.cpp index 444def5317..7b722f6b88 100644 --- a/unit_tests/command_queue/enqueue_svm_mem_copy_tests.cpp +++ b/unit_tests/command_queue/enqueue_svm_mem_copy_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -32,7 +32,7 @@ struct EnqueueSvmMemCopyTest : public DeviceFixture, return; } - CommandQueueFixture::SetUp(pDevice, 0); + CommandQueueFixture::SetUp(pClDevice, 0); srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); ASSERT_NE(nullptr, srcSvmPtr); dstSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); @@ -310,7 +310,7 @@ struct EnqueueSvmMemCopyHw : public ::testing::Test { void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); if (is32bit || !device->isFullRangeSvm()) { GTEST_SKIP(); } @@ -329,7 +329,7 @@ struct EnqueueSvmMemCopyHw : public ::testing::Test { alignedFree(dstHostPtr); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; uint64_t bigSize = 5ull * MemoryConstants::gigaByte; uint64_t smallSize = 4ull * MemoryConstants::gigaByte - 1; diff --git a/unit_tests/command_queue/enqueue_svm_mem_fill_tests.cpp b/unit_tests/command_queue/enqueue_svm_mem_fill_tests.cpp index 529433e27c..3a9be43d57 100644 --- a/unit_tests/command_queue/enqueue_svm_mem_fill_tests.cpp +++ b/unit_tests/command_queue/enqueue_svm_mem_fill_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,7 +26,7 @@ struct EnqueueSvmMemFillTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(pDevice, 0); + CommandQueueFixture::SetUp(pClDevice, 0); const HardwareInfo &hwInfo = pDevice->getHardwareInfo(); if (!hwInfo.capabilityTable.ftrSvm) { GTEST_SKIP(); @@ -153,7 +153,7 @@ struct EnqueueSvmMemFillHw : public ::testing::Test { void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); if (is32bit || !device->isFullRangeSvm()) { GTEST_SKIP(); } @@ -170,7 +170,7 @@ struct EnqueueSvmMemFillHw : public ::testing::Test { context->getSVMAllocsManager()->freeSVMAlloc(svmPtr); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; uint64_t bigSize = 5ull * MemoryConstants::gigaByte; uint64_t smallSize = 4ull * MemoryConstants::gigaByte - 1; diff --git a/unit_tests/command_queue/enqueue_svm_tests.cpp b/unit_tests/command_queue/enqueue_svm_tests.cpp index fbc7fec229..aa05da702c 100644 --- a/unit_tests/command_queue/enqueue_svm_tests.cpp +++ b/unit_tests/command_queue/enqueue_svm_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -42,7 +42,7 @@ struct EnqueueSvmTest : public DeviceFixture, GTEST_SKIP(); } DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(pDevice, 0); + CommandQueueFixture::SetUp(pClDevice, 0); ptrSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); } @@ -321,7 +321,7 @@ HWTEST_F(EnqueueSvmTest, givenSrcHostPtrWhenEnqueueSVMMemcpyThenEnqueuWriteBuffe char srcHostPtr[260]; void *pSrcSVM = srcHostPtr; void *pDstSVM = ptrSVM; - MockCommandQueueHw myCmdQ(context, pDevice, 0); + MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemcpy( false, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -352,7 +352,7 @@ HWTEST_F(EnqueueSvmTest, givenDstHostPtrWhenEnqueueSVMMemcpyThenEnqueuReadBuffer char dstHostPtr[260]; void *pDstSVM = dstHostPtr; void *pSrcSVM = ptrSVM; - MockCommandQueueHw myCmdQ(context, pDevice, 0); + MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemcpy( false, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -421,7 +421,7 @@ HWTEST_F(EnqueueSvmTest, givenDstHostPtrAndSrcHostPtrWhenEnqueueNonBlockingSVMMe char srcHostPtr[] = {1, 2, 3}; void *pDstSVM = dstHostPtr; void *pSrcSVM = srcHostPtr; - MockCommandQueueHw myCmdQ(context, pDevice, 0); + MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemcpy( false, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -454,7 +454,7 @@ HWTEST_F(EnqueueSvmTest, givenDstHostPtrAndSrcHostPtrWhenEnqueueBlockingSVMMemcp char srcHostPtr[] = {1, 2, 3}; void *pDstSVM = dstHostPtr; void *pSrcSVM = srcHostPtr; - MockCommandQueueHw myCmdQ(context, pDevice, 0); + MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemcpy( true, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -497,7 +497,7 @@ TEST_F(EnqueueSvmTest, givenDstHostPtrAndSrcHostPtrAndSizeZeroWhenEnqueueSVMMemc HWTEST_F(EnqueueSvmTest, givenSvmToSvmCopyTypeWhenEnqueueNonBlockingSVMMemcpyThenSvmMemcpyCommandIsEnqueued) { void *pDstSVM = ptrSVM; void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); - MockCommandQueueHw myCmdQ(context, pDevice, 0); + MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemcpy( false, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -601,7 +601,7 @@ TEST_F(EnqueueSvmTest, GivenCoherencyWhenCopyingMemoryWithBlockingThenSuccessIsR HWTEST_F(EnqueueSvmTest, givenUnalignedAddressWhenEnqueueMemcpyThenDispatchInfoHasAlignedAddressAndProperOffset) { void *pDstSVM = reinterpret_cast(0x17); void *pSrcSVM = ptrSVM; - MockCommandQueueHw myCmdQ(context, pDevice, 0); + MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemcpy( false, // cl_bool blocking_copy pDstSVM, // void *dst_ptr @@ -642,7 +642,7 @@ TEST_F(EnqueueSvmTest, GivenNullSvmPtrWhenFillingMemoryThenInvalidValueErrorIsRe HWTEST_F(EnqueueSvmTest, givenSvmAllocWhenEnqueueSvmFillThenSuccesIsReturnedAndAddressIsProperlyAligned) { const float pattern[1] = {1.2345f}; const size_t patternSize = sizeof(pattern); - MockCommandQueueHw myCmdQ(context, pDevice, 0); + MockCommandQueueHw myCmdQ(context, pClDevice, 0); retVal = myCmdQ.enqueueSVMMemFill( ptrSVM, // void *svm_ptr pattern, // const void *pattern @@ -734,8 +734,8 @@ TEST_F(EnqueueSvmTest, GivenSvmAllocationWhenEnqueingKernelThenSuccessIsReturned GraphicsAllocation *pSvmAlloc = svmData->gpuAllocation; EXPECT_NE(nullptr, ptrSVM); - std::unique_ptr program(Program::create("FillBufferBytes", context, *pDevice, true, &retVal)); - cl_device_id device = pDevice; + std::unique_ptr program(Program::create("FillBufferBytes", context, *pClDevice, true, &retVal)); + cl_device_id device = pClDevice; program->build(1, &device, nullptr, nullptr, nullptr, false); std::unique_ptr kernel(Kernel::create(program.get(), *program->getKernelInfo("FillBufferBytes"), &retVal)); @@ -763,8 +763,8 @@ TEST_F(EnqueueSvmTest, givenEnqueueTaskBlockedOnUserEventWhenItIsEnqueuedThenSur GraphicsAllocation *pSvmAlloc = svmData->gpuAllocation; EXPECT_NE(nullptr, ptrSVM); - auto program = clUniquePtr(Program::create("FillBufferBytes", context, *pDevice, true, &retVal)); - cl_device_id device = pDevice; + auto program = clUniquePtr(Program::create("FillBufferBytes", context, *pClDevice, true, &retVal)); + cl_device_id device = pClDevice; program->build(1, &device, nullptr, nullptr, nullptr, false); auto kernel = clUniquePtr(Kernel::create(program.get(), *program->getKernelInfo("FillBufferBytes"), &retVal)); @@ -874,7 +874,7 @@ TEST(CreateSvmAllocTests, givenVariousSvmAllocationPropertiesWhenAllocatingSvmTh for (auto isLocalMemorySupported : ::testing::Bool()) { DebugManager.flags.EnableLocalMemory.set(isLocalMemorySupported); - auto mockDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); auto mockContext = std::make_unique(mockDevice.get()); for (auto isReadOnly : ::testing::Bool()) { @@ -900,7 +900,7 @@ struct EnqueueSvmTestLocalMemory : public DeviceFixture, DebugManager.flags.EnableLocalMemory.set(1); DeviceFixture::SetUp(); - context = std::make_unique(pDevice, true); + context = std::make_unique(pClDevice, true); size = 256; svmPtr = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), size, {}); ASSERT_NE(nullptr, svmPtr); @@ -926,7 +926,7 @@ struct EnqueueSvmTestLocalMemory : public DeviceFixture, }; HWTEST_F(EnqueueSvmTestLocalMemory, givenWriteInvalidateRegionFlagWhenMappingSvmThenMapIsSuccessfulAndReadOnlyFlagIsFalse) { - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); uintptr_t offset = 64; void *regionSvmPtr = ptrOffset(svmPtr, offset); size_t regionSize = 64; @@ -945,7 +945,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenWriteInvalidateRegionFlagWhenMappingSvm } HWTEST_F(EnqueueSvmTestLocalMemory, givenMapWriteFlagWhenMappingSvmThenMapIsSuccessfulAndReadOnlyFlagIsFalse) { - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); uintptr_t offset = 64; void *regionSvmPtr = ptrOffset(svmPtr, offset); size_t regionSize = 64; @@ -964,7 +964,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenMapWriteFlagWhenMappingSvmThenMapIsSucc } HWTEST_F(EnqueueSvmTestLocalMemory, givenMapReadFlagWhenMappingSvmThenMapIsSuccessfulAndReadOnlyFlagIsTrue) { - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); uintptr_t offset = 64; void *regionSvmPtr = ptrOffset(svmPtr, offset); size_t regionSize = 64; @@ -983,7 +983,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenMapReadFlagWhenMappingSvmThenMapIsSucce } HWTEST_F(EnqueueSvmTestLocalMemory, givenSvmAllocWithoutFlagsWhenMappingSvmThenMapIsSuccessfulAndReadOnlyFlagIsTrue) { - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); uintptr_t offset = 64; void *regionSvmPtr = ptrOffset(svmPtr, offset); size_t regionSize = 64; @@ -1003,7 +1003,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenSvmAllocWithoutFlagsWhenMappingSvmThenM HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenEnqeueMapValidSvmPtrThenExpectSingleWalker) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); LinearStream &stream = queue.getCS(0x1000); cl_event event = nullptr; @@ -1043,7 +1043,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenEnqeueMapValidSvm HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenEnqeueMapSvmPtrTwiceThenExpectSingleWalker) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); LinearStream &stream = queue.getCS(0x1000); uintptr_t offset = 64; @@ -1096,7 +1096,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenEnqeueMapSvmPtrTw HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenNoMappedSvmPtrThenExpectNoUnmapCopyKernel) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); LinearStream &stream = queue.getCS(0x1000); cl_event event = nullptr; @@ -1122,7 +1122,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenNoMappedSvmPtrThe HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenMappedSvmRegionIsReadOnlyThenExpectNoUnmapCopyKernel) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); LinearStream &stream = queue.getCS(0x1000); retVal = queue.enqueueSVMMap( @@ -1170,7 +1170,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenMappedSvmRegionIs HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenMappedSvmRegionIsWritableThenExpectMapAndUnmapCopyKernel) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); LinearStream &stream = queue.getCS(0x1000); cl_event eventMap = nullptr; @@ -1217,7 +1217,7 @@ HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenMappedSvmRegionIs HWTEST_F(EnqueueSvmTestLocalMemory, givenEnabledLocalMemoryWhenMappedSvmRegionAndNoEventIsUsedIsWritableThenExpectMapAndUnmapCopyKernelAnNo) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - MockCommandQueueHw queue(context.get(), pDevice, nullptr); + MockCommandQueueHw queue(context.get(), pClDevice, nullptr); LinearStream &stream = queue.getCS(0x1000); retVal = queue.enqueueSVMMap( @@ -1286,7 +1286,7 @@ HWTEST_F(EnqueueSvmTest, GivenDstHostPtrWhenHostPtrAllocationCreationFailsThenRe char dstHostPtr[260]; void *pDstSVM = dstHostPtr; void *pSrcSVM = ptrSVM; - MockCommandQueueHw cmdQ(context, pDevice, nullptr); + MockCommandQueueHw cmdQ(context, pClDevice, nullptr); auto failCsr = std::make_unique>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()); CommandStreamReceiver *oldCommandStreamReceiver = cmdQ.gpgpuEngine->commandStreamReceiver; cmdQ.gpgpuEngine->commandStreamReceiver = failCsr.get(); @@ -1307,7 +1307,7 @@ HWTEST_F(EnqueueSvmTest, GivenSrcHostPtrAndSizeZeroWhenHostPtrAllocationCreation char srcHostPtr[260]; void *pDstSVM = ptrSVM; void *pSrcSVM = srcHostPtr; - MockCommandQueueHw cmdQ(context, pDevice, nullptr); + MockCommandQueueHw cmdQ(context, pClDevice, nullptr); auto failCsr = std::make_unique>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()); CommandStreamReceiver *oldCommandStreamReceiver = cmdQ.gpgpuEngine->commandStreamReceiver; cmdQ.gpgpuEngine->commandStreamReceiver = failCsr.get(); @@ -1329,7 +1329,7 @@ HWTEST_F(EnqueueSvmTest, givenDstHostPtrAndSrcHostPtrWhenHostPtrAllocationCreati char srcHostPtr[260]; void *pDstSVM = dstHostPtr; void *pSrcSVM = srcHostPtr; - MockCommandQueueHw cmdQ(context, pDevice, nullptr); + MockCommandQueueHw cmdQ(context, pClDevice, nullptr); auto failCsr = std::make_unique>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()); CommandStreamReceiver *oldCommandStreamReceiver = cmdQ.gpgpuEngine->commandStreamReceiver; cmdQ.gpgpuEngine->commandStreamReceiver = failCsr.get(); diff --git a/unit_tests/command_queue/enqueue_thread_tests.cpp b/unit_tests/command_queue/enqueue_thread_tests.cpp index 0fef391199..f4d70b665b 100644 --- a/unit_tests/command_queue/enqueue_thread_tests.cpp +++ b/unit_tests/command_queue/enqueue_thread_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,11 +27,13 @@ class CommandStreamReceiverMock : public UltCommandStreamReceiver { private: std::vector toFree; // pointers to be freed on destruction Device *pDevice; + ClDevice *pClDevice; public: size_t expectedToFreeCount = (size_t)-1; CommandStreamReceiverMock(Device *pDevice) : UltCommandStreamReceiver(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()) { this->pDevice = pDevice; + this->pClDevice = platform()->clDeviceMap[pDevice]; } bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override { @@ -47,7 +49,7 @@ class CommandStreamReceiverMock : public UltCommandStreamReceiver { } ~CommandStreamReceiverMock() override { - EXPECT_FALSE(pDevice->hasOwnership()); + EXPECT_FALSE(pClDevice->hasOwnership()); if (expectedToFreeCount == (size_t)-1) { EXPECT_GT(toFree.size(), 0u); //make sure flush was called } else { @@ -64,7 +66,7 @@ class CommandStreamReceiverMock : public UltCommandStreamReceiver { struct EnqueueThreadingFixture : public DeviceFixture { void SetUp() { DeviceFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); pCmdQ = nullptr; } @@ -78,12 +80,12 @@ struct EnqueueThreadingFixture : public DeviceFixture { class MyCommandQueue : public CommandQueueHw { public: MyCommandQueue(Context *context, - Device *device, + ClDevice *device, const cl_queue_properties *props) : CommandQueueHw(context, device, props), kernel(nullptr) { } static CommandQueue *create(Context *context, - Device *device, + ClDevice *device, cl_command_queue_properties props) { const cl_queue_properties properties[3] = {CL_QUEUE_PROPERTIES, props, 0}; return new MyCommandQueue(context, device, properties); @@ -110,7 +112,7 @@ struct EnqueueThreadingFixture : public DeviceFixture { template void createCQ() { - pCmdQ = MyCommandQueue::create(context, pDevice, 0); + pCmdQ = MyCommandQueue::create(context, pClDevice, 0); ASSERT_NE(nullptr, pCmdQ); auto pCommandStreamReceiver = new CommandStreamReceiverMock(pDevice); diff --git a/unit_tests/command_queue/enqueue_unmap_memobject_tests.cpp b/unit_tests/command_queue/enqueue_unmap_memobject_tests.cpp index ddef1af41a..c5a3a3478f 100644 --- a/unit_tests/command_queue/enqueue_unmap_memobject_tests.cpp +++ b/unit_tests/command_queue/enqueue_unmap_memobject_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -29,7 +29,7 @@ struct EnqueueUnmapMemObjTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(pDevice, 0); + CommandQueueFixture::SetUp(pClDevice, 0); BufferDefaults::context = new MockContext; buffer = BufferHelper>::create(); mappedPtr = pCmdQ->enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, 8, 0, nullptr, nullptr, retVal); @@ -239,7 +239,7 @@ HWTEST_F(EnqueueUnmapMemObjTest, givenMemObjWhenUnmappingThenSetAubWritableBefor } }; - MyMockCommandQueue myMockCmdQ(BufferDefaults::context, pDevice, nullptr); + MyMockCommandQueue myMockCmdQ(BufferDefaults::context, pClDevice, nullptr); { auto mapPtr = myMockCmdQ.enqueueMapBuffer(buffer.get(), CL_TRUE, CL_MAP_WRITE, 0, 8, 0, nullptr, nullptr, retVal); diff --git a/unit_tests/command_queue/enqueue_write_buffer_event_tests.cpp b/unit_tests/command_queue/enqueue_write_buffer_event_tests.cpp index 750d188af2..0b0ba84e32 100644 --- a/unit_tests/command_queue/enqueue_write_buffer_event_tests.cpp +++ b/unit_tests/command_queue/enqueue_write_buffer_event_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -216,7 +216,7 @@ TEST_F(EnqueueWriteBufferTypeTest, givenInOrderQueueAndForcedCpuCopyOnWriteBuffe TEST_F(EnqueueWriteBufferTypeTest, givenOutOfOrderQueueAndForcedCpuCopyOnWriteBufferAndDstPtrEqualSrcPtrWithEventsWhenWriteBufferIsExecutedThenTaskLevelShouldNotBeIncreased) { DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnWriteBuffer.set(true); - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); cl_int retVal = CL_SUCCESS; uint32_t taskLevelCmdQ = 17; pCmdOOQ->taskLevel = taskLevelCmdQ; @@ -299,7 +299,7 @@ TEST_F(EnqueueWriteBufferTypeTest, givenInOrderQueueAndDisabledSupportCpuCopiesA TEST_F(EnqueueWriteBufferTypeTest, givenOutOfOrderQueueAndDisabledSupportCpuCopiesAndDstPtrEqualSrcPtrWithEventsWhenWriteBufferIsExecutedThenTaskLevelShouldNotBeIncreased) { DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnWriteBuffer.set(false); - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); cl_int retVal = CL_SUCCESS; uint32_t taskLevelCmdQ = 17; pCmdOOQ->taskLevel = taskLevelCmdQ; diff --git a/unit_tests/command_queue/enqueue_write_buffer_rect_fixture.h b/unit_tests/command_queue/enqueue_write_buffer_rect_fixture.h index 8375d0c9c6..60e0172ce3 100644 --- a/unit_tests/command_queue/enqueue_write_buffer_rect_fixture.h +++ b/unit_tests/command_queue/enqueue_write_buffer_rect_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,7 @@ struct EnqueueWriteBufferRectTest : public CommandEnqueueFixture, void SetUp() override { CommandEnqueueFixture::SetUp(); - context.reset(new MockContext(&pCmdQ->getDevice())); + context.reset(new MockContext(pClDevice)); BufferDefaults::context = context.get(); //For 3D diff --git a/unit_tests/command_queue/enqueue_write_buffer_rect_tests.cpp b/unit_tests/command_queue/enqueue_write_buffer_rect_tests.cpp index 9ddca6507c..43821e9c09 100644 --- a/unit_tests/command_queue/enqueue_write_buffer_rect_tests.cpp +++ b/unit_tests/command_queue/enqueue_write_buffer_rect_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -287,7 +287,7 @@ HWTEST_F(EnqueueWriteBufferRectTest, givenInOrderQueueAndDstPtrEqualSrcPtrWhenWr } HWTEST_F(EnqueueWriteBufferRectTest, givenOutOfOrderQueueAndDstPtrEqualSrcPtrWhenWriteBufferIsExecutedThenTaskLevelShouldNotBeIncreased) { cl_int retVal = CL_SUCCESS; - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); void *ptr = buffer->getCpuAddressForMemoryTransfer(); size_t bufferOrigin[] = {0, 0, 0}; size_t hostOrigin[] = {0, 0, 0}; @@ -358,7 +358,7 @@ HWTEST_F(EnqueueWriteBufferRectTest, givenInOrderQueueAndDstPtrEqualSrcPtrWithEv } HWTEST_F(EnqueueWriteBufferRectTest, givenOutOfOrderQueueAndDstPtrEqualSrcPtrWithEventsWhenWriteBufferIsExecutedThenTaskLevelShouldNotBeIncreased) { cl_int retVal = CL_SUCCESS; - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); uint32_t taskLevelCmdQ = 17; pCmdOOQ->taskLevel = taskLevelCmdQ; @@ -617,11 +617,11 @@ struct EnqueueWriteBufferRectHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; MockBuffer srcBuffer; diff --git a/unit_tests/command_queue/enqueue_write_buffer_tests.cpp b/unit_tests/command_queue/enqueue_write_buffer_tests.cpp index bbf2866c3e..e0ae5bc949 100644 --- a/unit_tests/command_queue/enqueue_write_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_write_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -256,7 +256,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenOOQWithEnabledSupportCpuCopiesAndDstPt DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnWriteBuffer.set(true); cl_int retVal = CL_SUCCESS; - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); void *ptr = zeroCopyBuffer->getCpuAddressForMemoryTransfer(); EXPECT_EQ(retVal, CL_SUCCESS); retVal = pCmdOOQ->enqueueWriteBuffer(zeroCopyBuffer.get(), @@ -277,7 +277,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenOOQWithDisabledSupportCpuCopiesAndDstP DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnWriteBuffer.set(false); cl_int retVal = CL_SUCCESS; - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); EXPECT_EQ(retVal, CL_SUCCESS); retVal = pCmdOOQ->enqueueWriteBuffer(zeroCopyBuffer.get(), @@ -380,7 +380,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenEnqueueWriteBufferCalledWhenLockedPtrI MockContext ctx; cl_int retVal; ctx.memoryManager = &memoryManager; - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); @@ -408,7 +408,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse MockContext ctx; cl_int retVal; ctx.memoryManager = &memoryManager; - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); @@ -454,7 +454,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenEnqueueWriteBufferCalledWhenLockedPtrI MockContext ctx; cl_int retVal; ctx.memoryManager = &memoryManager; - auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::System4KBPages); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); @@ -496,11 +496,11 @@ struct EnqueueWriteBufferHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; MockBuffer srcBuffer; uint64_t bigSize = 4ull * MemoryConstants::gigaByte; diff --git a/unit_tests/command_queue/enqueue_write_image_fixture.h b/unit_tests/command_queue/enqueue_write_image_fixture.h index e6643b39f0..0af1850ed2 100644 --- a/unit_tests/command_queue/enqueue_write_image_fixture.h +++ b/unit_tests/command_queue/enqueue_write_image_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,7 +26,7 @@ struct EnqueueWriteImageTest : public CommandEnqueueFixture, virtual void SetUp(void) override { CommandEnqueueFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); dstImage = Image2dHelper<>::create(context); const auto &imageDesc = dstImage->getImageDesc(); diff --git a/unit_tests/command_queue/enqueue_write_image_tests.cpp b/unit_tests/command_queue/enqueue_write_image_tests.cpp index 1722bf6b3b..4620b288a5 100644 --- a/unit_tests/command_queue/enqueue_write_image_tests.cpp +++ b/unit_tests/command_queue/enqueue_write_image_tests.cpp @@ -291,7 +291,7 @@ HWTEST_F(EnqueueWriteImageTest, GivenImage1DAndImageShareTheSameStorageWithHostP cl_int retVal = CL_SUCCESS; std::unique_ptr dstImage2(Image1dHelper<>::create(context)); auto imageDesc = dstImage2->getImageDesc(); - std::unique_ptr pCmdOOQ(createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); + std::unique_ptr pCmdOOQ(createCommandQueue(pClDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)); size_t origin[] = {0, 0, 0}; size_t region[] = {imageDesc.image_width, 1, 1}; void *ptr = dstImage2->getCpuAddressForMemoryTransfer(); diff --git a/unit_tests/command_queue/finish_tests.cpp b/unit_tests/command_queue/finish_tests.cpp index 5804c1a0bd..6a6a18e56e 100644 --- a/unit_tests/command_queue/finish_tests.cpp +++ b/unit_tests/command_queue/finish_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,7 +25,7 @@ struct FinishFixture : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueHwFixture::SetUp(pDevice, 0); + CommandQueueHwFixture::SetUp(pClDevice, 0); ASSERT_NE(nullptr, pCmdQ); CommandStreamFixture::SetUp(pCmdQ); ASSERT_NE(nullptr, pCS); @@ -86,8 +86,8 @@ HWTEST_F(FinishTest, WhenFinishIsCalledThenPipeControlIsNotAddedToCqCommandStrea EXPECT_EQ(cmdList.rend(), itorCmd); } HWTEST_F(FinishTest, givenFreshQueueWhenFinishIsCalledThenCommandStreamIsNotAllocated) { - MockContext contextWithMockCmdQ(pDevice, true); - MockCommandQueueHw cmdQ(&contextWithMockCmdQ, pDevice, 0); + MockContext contextWithMockCmdQ(pClDevice, true); + MockCommandQueueHw cmdQ(&contextWithMockCmdQ, pClDevice, 0); auto retVal = cmdQ.finish(); ASSERT_EQ(CL_SUCCESS, retVal); diff --git a/unit_tests/command_queue/flush_tests.cpp b/unit_tests/command_queue/flush_tests.cpp index 9b35ddd9ba..fb40ed4241 100644 --- a/unit_tests/command_queue/flush_tests.cpp +++ b/unit_tests/command_queue/flush_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,7 +24,7 @@ struct FlushTest void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(nullptr, pDevice, 0); + CommandQueueFixture::SetUp(nullptr, pClDevice, 0); CommandStreamFixture::SetUp(pCmdQ); } diff --git a/unit_tests/command_queue/get_command_queue_info_tests.cpp b/unit_tests/command_queue/get_command_queue_info_tests.cpp index 5be5324f42..e008e52440 100644 --- a/unit_tests/command_queue/get_command_queue_info_tests.cpp +++ b/unit_tests/command_queue/get_command_queue_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,9 +27,9 @@ struct GetCommandQueueInfoTest : public DeviceFixture, properties = GetParam(); DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); - CommandQueueFixture::SetUp(pContext, pDevice, properties); + CommandQueueFixture::SetUp(pContext, pClDevice, properties); } void TearDown() override { @@ -55,7 +55,7 @@ TEST_P(GetCommandQueueInfoTest, CONTEXT) { } TEST_P(GetCommandQueueInfoTest, DEVICE) { - cl_device_id device_expected = pDevice; + cl_device_id device_expected = pClDevice; cl_device_id device_id_returned = nullptr; auto retVal = pCmdQ->getCommandQueueInfo( diff --git a/unit_tests/command_queue/get_size_required_buffer_tests.cpp b/unit_tests/command_queue/get_size_required_buffer_tests.cpp index 2e1dcb5299..e8ca000a49 100644 --- a/unit_tests/command_queue/get_size_required_buffer_tests.cpp +++ b/unit_tests/command_queue/get_size_required_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -37,8 +37,8 @@ struct GetSizeRequiredBufferTest : public CommandEnqueueFixture, void SetUp() override { CommandEnqueueFixture::SetUp(); - SimpleArgKernelFixture::SetUp(pDevice); - HelloWorldKernelFixture::SetUp(pDevice, "CopyBuffer_simd", "CopyBuffer"); + SimpleArgKernelFixture::SetUp(pClDevice); + HelloWorldKernelFixture::SetUp(pClDevice, "CopyBuffer_simd", "CopyBuffer"); BufferDefaults::context = new MockContext; srcBuffer = BufferHelper<>::create(); dstBuffer = BufferHelper<>::create(); diff --git a/unit_tests/command_queue/get_size_required_image_tests.cpp b/unit_tests/command_queue/get_size_required_image_tests.cpp index 964b47b730..1bb848c883 100644 --- a/unit_tests/command_queue/get_size_required_image_tests.cpp +++ b/unit_tests/command_queue/get_size_required_image_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -113,8 +113,8 @@ HWTEST_F(GetSizeRequiredImageTest, WhenCopyingReadWriteImageThenHeapsAndCommandB auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeSSH = ssh.getUsed(); - std::unique_ptr program(Program::create("CopyImageToImage3d", context, *pDevice, true, nullptr)); - cl_device_id device = pDevice; + std::unique_ptr program(Program::create("CopyImageToImage3d", context, *pClDevice, true, nullptr)); + cl_device_id device = pClDevice; program->build(1, &device, nullptr, nullptr, nullptr, false); std::unique_ptr kernel(Kernel::create(program.get(), *program->getKernelInfo("CopyImageToImage3d"), nullptr)); diff --git a/unit_tests/command_queue/local_work_size_tests.cpp b/unit_tests/command_queue/local_work_size_tests.cpp index 763a10615c..2d4fab8454 100644 --- a/unit_tests/command_queue/local_work_size_tests.cpp +++ b/unit_tests/command_queue/local_work_size_tests.cpp @@ -625,7 +625,7 @@ TEST(localWorkSizeTest, givenDeviceWith56ThreadsPerSubsliceWhenSimd16KernelIsBei } TEST(localWorkSizeTest, givenDispatchInfoWhenWorkSizeInfoIsCreatedThenItHasCorrectNumberOfThreads) { - MockDevice device; + MockClDevice device{new MockDevice}; MockKernelWithInternals kernel(device); DispatchInfo dispatchInfo; dispatchInfo.setKernel(kernel.mockKernel); diff --git a/unit_tests/command_queue/multiple_map_buffer_tests.cpp b/unit_tests/command_queue/multiple_map_buffer_tests.cpp index e4202137d2..c1162437be 100644 --- a/unit_tests/command_queue/multiple_map_buffer_tests.cpp +++ b/unit_tests/command_queue/multiple_map_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -43,7 +43,7 @@ struct MultipleMapBufferTest : public DeviceFixture, public ::testing::Test { template struct MockCmdQ : public CommandQueueHw { - MockCmdQ(Context *context, Device *device) : CommandQueueHw(context, device, 0) {} + MockCmdQ(Context *context, ClDevice *device) : CommandQueueHw(context, device, 0) {} cl_int enqueueReadBuffer(Buffer *buffer, cl_bool blockingRead, size_t offset, size_t size, void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList, const cl_event *eventWaitList, @@ -101,12 +101,12 @@ struct MultipleMapBufferTest : public DeviceFixture, public ::testing::Test { template std::unique_ptr> createMockCmdQ() { - return std::unique_ptr>(new MockCmdQ(context, pDevice)); + return std::unique_ptr>(new MockCmdQ(context, pClDevice)); } void SetUp() override { DeviceFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); } void TearDown() override { diff --git a/unit_tests/command_queue/multiple_map_image_tests.cpp b/unit_tests/command_queue/multiple_map_image_tests.cpp index 93893a18b8..ccb74afc65 100644 --- a/unit_tests/command_queue/multiple_map_image_tests.cpp +++ b/unit_tests/command_queue/multiple_map_image_tests.cpp @@ -62,7 +62,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test { template struct MockCmdQ : public CommandQueueHw { - MockCmdQ(Context *context, Device *device) : CommandQueueHw(context, device, 0) {} + MockCmdQ(Context *context, ClDevice *device) : CommandQueueHw(context, device, 0) {} cl_int enqueueReadImage(Image *srcImage, cl_bool blockingRead, const size_t *origin, const size_t *region, size_t rowPitch, size_t slicePitch, void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) override { @@ -122,12 +122,12 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test { template std::unique_ptr> createMockCmdQ() { - return std::unique_ptr>(new MockCmdQ(context, pDevice)); + return std::unique_ptr>(new MockCmdQ(context, pClDevice)); } void SetUp() override { DeviceFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); } void TearDown() override { diff --git a/unit_tests/command_queue/oom_buffer_tests.cpp b/unit_tests/command_queue/oom_buffer_tests.cpp index 7f96c8273a..4cc5b67b6b 100644 --- a/unit_tests/command_queue/oom_buffer_tests.cpp +++ b/unit_tests/command_queue/oom_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -47,11 +47,11 @@ struct OOMCommandQueueBufferTest : public MemoryManagementFixture, MemoryManagement::breakOnAllocationEvent = 77; MemoryManagementFixture::SetUp(); DeviceFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); BufferDefaults::context = context; - CommandQueueFixture::SetUp(context, pDevice, 0); - SimpleArgKernelFixture::SetUp(pDevice); - HelloWorldKernelFixture::SetUp(pDevice, "CopyBuffer_simd", "CopyBuffer"); + CommandQueueFixture::SetUp(context, pClDevice, 0); + SimpleArgKernelFixture::SetUp(pClDevice); + HelloWorldKernelFixture::SetUp(pClDevice, "CopyBuffer_simd", "CopyBuffer"); srcBuffer = BufferHelper<>::create(); dstBuffer = BufferHelper<>::create(); @@ -92,7 +92,7 @@ struct OOMCommandQueueBufferTest : public MemoryManagementFixture, }; HWTEST_P(OOMCommandQueueBufferTest, enqueueCopyBuffer) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -116,7 +116,7 @@ HWTEST_P(OOMCommandQueueBufferTest, enqueueCopyBuffer) { } HWTEST_P(OOMCommandQueueBufferTest, enqueueFillBuffer) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -140,7 +140,7 @@ HWTEST_P(OOMCommandQueueBufferTest, enqueueFillBuffer) { } HWTEST_P(OOMCommandQueueBufferTest, enqueueReadBuffer) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -164,7 +164,7 @@ HWTEST_P(OOMCommandQueueBufferTest, enqueueReadBuffer) { } HWTEST_P(OOMCommandQueueBufferTest, enqueueWriteBuffer) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -188,7 +188,7 @@ HWTEST_P(OOMCommandQueueBufferTest, enqueueWriteBuffer) { } HWTEST_P(OOMCommandQueueBufferTest, enqueueWriteBufferRect) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -213,7 +213,7 @@ HWTEST_P(OOMCommandQueueBufferTest, enqueueWriteBufferRect) { HWTEST_P(OOMCommandQueueBufferTest, enqueueKernelHelloWorld) { typedef HelloWorldKernelFixture KernelFixture; - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -243,7 +243,7 @@ HWTEST_P(OOMCommandQueueBufferTest, enqueueKernelHelloWorld) { HWTEST_P(OOMCommandQueueBufferTest, enqueueKernelSimpleArg) { typedef SimpleArgKernelFixture KernelFixture; - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); diff --git a/unit_tests/command_queue/oom_image_tests.cpp b/unit_tests/command_queue/oom_image_tests.cpp index f02812f55a..9cdac57dc6 100644 --- a/unit_tests/command_queue/oom_image_tests.cpp +++ b/unit_tests/command_queue/oom_image_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,8 +36,8 @@ struct OOMCommandQueueImageTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - context = new MockContext(pDevice); - CommandQueueFixture::SetUp(context, pDevice, 0); + context = new MockContext(pClDevice); + CommandQueueFixture::SetUp(context, pClDevice, 0); srcImage = Image2dHelper<>::create(context); dstImage = Image2dHelper<>::create(context); @@ -76,7 +76,7 @@ struct OOMCommandQueueImageTest : public DeviceFixture, }; HWTEST_P(OOMCommandQueueImageTest, enqueueCopyImage) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -100,7 +100,7 @@ HWTEST_P(OOMCommandQueueImageTest, enqueueCopyImage) { } HWTEST_P(OOMCommandQueueImageTest, enqueueFillImage) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -124,7 +124,7 @@ HWTEST_P(OOMCommandQueueImageTest, enqueueFillImage) { } HWTEST_P(OOMCommandQueueImageTest, enqueueReadImage) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); @@ -148,7 +148,7 @@ HWTEST_P(OOMCommandQueueImageTest, enqueueReadImage) { } HWTEST_P(OOMCommandQueueImageTest, enqueueWriteImage) { - CommandQueueHw cmdQ(context, pDevice, 0); + CommandQueueHw cmdQ(context, pClDevice, 0); auto &commandStream = pCmdQ->getCS(1024); auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10); diff --git a/unit_tests/command_queue/oom_tests.cpp b/unit_tests/command_queue/oom_tests.cpp index 4d42039bd2..027a0c3a78 100644 --- a/unit_tests/command_queue/oom_tests.cpp +++ b/unit_tests/command_queue/oom_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,8 +36,8 @@ struct OOMCommandQueueTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - context = new MockContext(pDevice); - CommandQueueFixture::SetUp(context, pDevice, 0); + context = new MockContext(pClDevice); + CommandQueueFixture::SetUp(context, pClDevice, 0); const auto &oomSetting = GetParam(); auto oomSize = 10u; diff --git a/unit_tests/command_queue/read_write_buffer_cpu_copy.cpp b/unit_tests/command_queue/read_write_buffer_cpu_copy.cpp index 9d347dc655..bae0cad0b9 100644 --- a/unit_tests/command_queue/read_write_buffer_cpu_copy.cpp +++ b/unit_tests/command_queue/read_write_buffer_cpu_copy.cpp @@ -124,7 +124,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, GivenSpecificMemoryStructuresWhenReadingWri auto smallBufferPtr = alignedMalloc(1 * MB, MemoryConstants::cacheLineSize); size_t largeBufferSize = 11u * MemoryConstants::megaByte; - auto mockDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto mockContext = std::unique_ptr(new MockContext(mockDevice.get())); auto memoryManager = static_cast(mockDevice->getMemoryManager()); memoryManager->turnOnFakingBigAllocations(); @@ -174,7 +174,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, GivenSpecificMemoryStructuresWhenReadingWri auto unalignedHostPtr = ptrOffset(alignedHostPtr, 1); size_t largeBufferSize = 11u * MemoryConstants::megaByte; - auto mockDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto mockContext = std::unique_ptr(new MockContext(mockDevice.get())); auto memoryManager = static_cast(mockDevice->getMemoryManager()); memoryManager->turnOnFakingBigAllocations(); @@ -206,7 +206,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, GivenSpecificMemoryStructuresWhenReadingWri } TEST(ReadWriteBufferOnCpu, givenNoHostPtrAndAlignedSizeWhenMemoryAllocationIsInNonSystemMemoryPoolThenIsReadWriteOnCpuAllowedReturnsFalse) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto memoryManager = new MockMemoryManager(*device->getExecutionEnvironment()); device->injectMemoryManager(memoryManager); diff --git a/unit_tests/command_queue/sync_buffer_handler_tests.cpp b/unit_tests/command_queue/sync_buffer_handler_tests.cpp index 9cd1370659..42ff72beae 100644 --- a/unit_tests/command_queue/sync_buffer_handler_tests.cpp +++ b/unit_tests/command_queue/sync_buffer_handler_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,9 +30,9 @@ class SyncBufferHandlerTest : public EnqueueHandlerTest { template void SetUpT() { EnqueueHandlerTest::SetUp(); - kernelInternals = std::make_unique(*pDevice, context); + kernelInternals = std::make_unique(*pClDevice, context); kernel = kernelInternals->mockKernel; - commandQueue = reinterpret_cast(new MockCommandQueueHw(context, pDevice, 0)); + commandQueue = reinterpret_cast(new MockCommandQueueHw(context, pClDevice, 0)); } template @@ -50,7 +50,7 @@ class SyncBufferHandlerTest : public EnqueueHandlerTest { } MockSyncBufferHandler *getSyncBufferHandler() { - return reinterpret_cast(pDevice->syncBufferHandler.get()); + return reinterpret_cast(pClDevice->syncBufferHandler.get()); } const cl_uint workDim = 1; @@ -114,7 +114,7 @@ HWTEST_TEMPLATED_F(SyncBufferHandlerTest, GivenSshRequiredWhenPatchingSyncBuffer kernelInternals->kernelInfo.requiresSshForBuffers = true; patchAllocateSyncBuffer(); - pDevice->allocateSyncBufferHandler(); + pClDevice->allocateSyncBufferHandler(); auto syncBufferHandler = getSyncBufferHandler(); auto surfaceState = reinterpret_cast(ptrOffset(kernel->getSurfaceStateHeap(), sPatchAllocateSyncBuffer.SurfaceStateHeapOffset)); @@ -138,7 +138,7 @@ HWTEST_TEMPLATED_F(SyncBufferHandlerTest, GivenKernelUsingSyncBufferWhenUsingSta TEST(SyncBufferHandlerDeviceTest, GivenRootDeviceWhenAllocateSyncBufferIsCalledTwiceThenTheObjectIsCreatedOnlyOnce) { const size_t testUsedBufferSize = 100; - MockDevice rootDevice; + MockClDevice rootDevice{new MockDevice}; rootDevice.allocateSyncBufferHandler(); auto syncBufferHandler = reinterpret_cast(rootDevice.syncBufferHandler.get()); @@ -153,16 +153,16 @@ TEST(SyncBufferHandlerDeviceTest, GivenRootDeviceWhenAllocateSyncBufferIsCalledT TEST(SyncBufferHandlerDeviceTest, GivenSubDeviceWhenAllocateSyncBufferIsCalledTwiceThenTheObjectIsCreatedOnlyOnce) { const size_t testUsedBufferSize = 100; - MockDevice rootDevice; - std::unique_ptr subDevice{reinterpret_cast(rootDevice.createSubDevice(0))}; - subDevice->allocateSyncBufferHandler(); - auto syncBufferHandler = reinterpret_cast(subDevice->syncBufferHandler.get()); + MockClDevice rootDevice{new MockDevice}; + ClDevice subDevice{*rootDevice.createSubDevice(0)}; + subDevice.allocateSyncBufferHandler(); + auto syncBufferHandler = reinterpret_cast(subDevice.syncBufferHandler.get()); ASSERT_NE(syncBufferHandler->usedBufferSize, testUsedBufferSize); syncBufferHandler->usedBufferSize = testUsedBufferSize; - subDevice->allocateSyncBufferHandler(); - syncBufferHandler = reinterpret_cast(subDevice->syncBufferHandler.get()); + subDevice.allocateSyncBufferHandler(); + syncBufferHandler = reinterpret_cast(subDevice.syncBufferHandler.get()); EXPECT_EQ(testUsedBufferSize, syncBufferHandler->usedBufferSize); } diff --git a/unit_tests/command_queue/zero_size_enqueue_tests.cpp b/unit_tests/command_queue/zero_size_enqueue_tests.cpp index 8158353c20..d915ddd914 100644 --- a/unit_tests/command_queue/zero_size_enqueue_tests.cpp +++ b/unit_tests/command_queue/zero_size_enqueue_tests.cpp @@ -62,9 +62,9 @@ class ZeroSizeEnqueueHandlerTestZeroGws : public ZeroSizeEnqueueHandlerTest { HWTEST_F(ZeroSizeEnqueueHandlerTestZeroGws, GivenZeroSizeEnqueueIsDetectedAndOpenClAtLeast21WhenEnqueingKernelThenCommandMarkerShouldBeEnqueued) { pDevice->enabledClVersion = 21; - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); for (auto testInput : testGwsInputs) { auto workDim = std::get<0>(testInput); @@ -82,9 +82,9 @@ HWTEST_F(ZeroSizeEnqueueHandlerTestZeroGws, GivenZeroSizeEnqueueIsDetectedAndOpe for (auto oclVersion : oclVersionsToTest) { pDevice->enabledClVersion = oclVersion; - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); for (auto testInput : testGwsInputs) { auto workDim = std::get<0>(testInput); @@ -99,9 +99,9 @@ HWTEST_F(ZeroSizeEnqueueHandlerTestZeroGws, GivenZeroSizeEnqueueIsDetectedAndOpe } HWTEST_F(ZeroSizeEnqueueHandlerTestZeroGws, GivenZeroSizeEnqueueIsDetectedAndLocalWorkSizeIsSetWhenEnqueingKernelThenNoExceptionIsThrown) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); mockKernel.mockProgram->setAllowNonUniform(true); auto workDim = 1; @@ -117,10 +117,10 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenEnqueingK if (pDevice->getEnabledClVersion() < 21) { return; } - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); size_t zeroGWS[] = {0, 0, 0}; mockCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, zeroGWS, nullptr, 0, nullptr, &event); EXPECT_EQ(static_cast(CL_COMMAND_MARKER), mockCmdQ->lastCommandType); @@ -136,7 +136,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenEnqueingK } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBufferThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); MockBuffer buffer; size_t memory[1]; @@ -146,7 +146,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBufferThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; MockBuffer buffer; @@ -166,7 +166,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBufferRectThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); MockBuffer buffer; size_t memory[1]; @@ -203,7 +203,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBufferRectThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; MockBuffer buffer; @@ -225,7 +225,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBufferThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); MockBuffer buffer; size_t memory[1]; @@ -235,7 +235,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBufferThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; MockBuffer buffer; @@ -255,7 +255,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBufferRectThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); MockBuffer buffer; size_t memory[1]; @@ -292,7 +292,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBufferRectThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; MockBuffer buffer; @@ -314,7 +314,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBufferThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); MockBuffer srcBuffer; MockBuffer dstBuffer; @@ -324,7 +324,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBufferThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; MockBuffer srcBuffer; @@ -344,7 +344,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBufferRectThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); MockBuffer srcBuffer; MockBuffer dstBuffer; @@ -381,7 +381,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, WhenCopyingBufferZeroSizeEnqueueIsDetectedWhenCopyingBufferRectThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; MockBuffer srcBuffer; @@ -403,7 +403,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, WhenCopyingBufferZeroSizeEnqueueIsDetectedW } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingBufferThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); MockBuffer buffer; cl_int pattern = 0xDEADBEEF; @@ -413,7 +413,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingBufferTheEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; MockBuffer buffer; @@ -433,7 +433,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingImageThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); std::unique_ptr image(Image2dHelper<>::create(&context)); size_t memory[1]; @@ -469,7 +469,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingImageThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; std::unique_ptr image(Image2dHelper<>::create(&context)); @@ -490,7 +490,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenReadingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingImageThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); std::unique_ptr image(Image2dHelper<>::create(&context)); size_t memory[1]; @@ -526,7 +526,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingImageThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; std::unique_ptr image(Image2dHelper<>::create(&context)); @@ -547,7 +547,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenWritingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingImageThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); std::unique_ptr srcImage(Image2dHelper<>::create(&context)); std::unique_ptr dstImage(Image2dHelper<>::create(&context)); @@ -584,7 +584,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingImageThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; std::unique_ptr srcImage(Image2dHelper<>::create(&context)); @@ -606,7 +606,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingImageToBufferThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); std::unique_ptr srcImage(Image2dHelper<>::create(&context)); std::unique_ptr dstBuffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal)); @@ -642,7 +642,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingImageToBufferThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; std::unique_ptr srcImage(Image2dHelper<>::create(&context)); @@ -663,7 +663,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBufferToImageThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); std::unique_ptr srcBuffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal)); std::unique_ptr dstImage(Image2dHelper<>::create(&context)); @@ -699,7 +699,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBufferToImageThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; std::unique_ptr srcBuffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal)); @@ -720,7 +720,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingBu } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingImageThenCommandMarkerShouldBeEnqueued) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); std::unique_ptr image(Image2dHelper<>::create(&context)); size_t origin[3] = {1024u, 1, 1}; @@ -756,7 +756,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingIm } HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingImageThenEventCommandTypeShouldBeUnchanged) { - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; std::unique_ptr image(Image2dHelper<>::create(&context)); @@ -780,7 +780,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingSv if (pDevice->getHardwareInfo().capabilityTable.ftrSvm == false) { GTEST_SKIP(); } - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); @@ -796,7 +796,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenCopyingSv if (pDevice->getHardwareInfo().capabilityTable.ftrSvm == false) { GTEST_SKIP(); } - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); @@ -822,7 +822,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingSv if (pDevice->getHardwareInfo().capabilityTable.ftrSvm == false) { GTEST_SKIP(); } - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); const float pattern[1] = {1.2345f}; @@ -837,7 +837,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, GivenZeroSizeEnqueueIsDetectedWhenFillingSv if (pDevice->getHardwareInfo().capabilityTable.ftrSvm == false) { GTEST_SKIP(); } - auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pDevice, 0)); + auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(&context, pClDevice, 0)); cl_event event; void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}); 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 b2dcea2b47..8225850912 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 @@ -901,7 +901,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur subCaptureManagerMock->setSubCaptureToggleActive(true); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -923,7 +923,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur subCaptureManagerMock->setSubCaptureToggleActive(true); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -950,7 +950,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur subCaptureManagerMock->setToggleFileName(newFileName); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -979,7 +979,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur subCaptureManagerMock->setToggleFileName(newFileName); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -1006,7 +1006,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur subCaptureManagerMock->setSubCaptureToggleActive(true); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -1026,7 +1026,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur subCaptureManagerMock->setSubCaptureToggleActive(true); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -1066,7 +1066,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur subCaptureManagerMock->setSubCaptureToggleActive(true); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1085,7 +1085,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon subCaptureManagerMock->setSubCaptureToggleActive(false); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1105,7 +1105,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon subCaptureManagerMock->setSubCaptureToggleActive(true); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1125,7 +1125,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon subCaptureManagerMock->setSubCaptureToggleActive(true); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1145,7 +1145,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon subCaptureManagerMock->setSubCaptureToggleActive(false); aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); diff --git a/unit_tests/command_stream/aub_subcapture_tests.cpp b/unit_tests/command_stream/aub_subcapture_tests.cpp index 11ef32be16..f88b7bdd1f 100644 --- a/unit_tests/command_stream/aub_subcapture_tests.cpp +++ b/unit_tests/command_stream/aub_subcapture_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -175,7 +175,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon); DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -190,7 +190,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon); DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -206,7 +206,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon); DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -222,7 +222,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon); DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -239,7 +239,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon); DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -255,7 +255,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon); DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -401,7 +401,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFil AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon); DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -514,9 +514,9 @@ TEST_F(AubSubCaptureTest, givenMultiDispatchInfoWithMultipleKernelsWhenGenerateT KernelInfo mainKernelInfo = {}; mainKernelInfo.name = "main_kernel"; - MockKernel mainKernel(program.get(), mainKernelInfo, *pDevice); - MockKernel kernel1(program.get(), kernelInfo, *pDevice); - MockKernel kernel2(program.get(), kernelInfo, *pDevice); + MockKernel mainKernel(program.get(), mainKernelInfo, *pClDevice); + MockKernel kernel1(program.get(), kernelInfo, *pClDevice); + MockKernel kernel2(program.get(), kernelInfo, *pClDevice); DispatchInfo mainDispatchInfo(&mainKernel, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); DispatchInfo dispatchInfo1(&kernel1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); @@ -544,7 +544,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenKernelNameIsSpec subCaptureCommon.subCaptureFilter.dumpKernelName = kernelName; DispatchInfo dispatchInfo; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); dispatchInfo.setKernel(&kernel); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp index f51b093227..4f8105429d 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp @@ -117,7 +117,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu auto &mockCsr = pDevice->getUltCommandStreamReceiver(); mockCsr.overrideDispatchPolicy(DispatchMode::BatchedDispatch); - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); configureCSRtoNonDirtyState(); @@ -196,7 +196,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeAndMidThreadP auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); @@ -817,7 +817,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithBothCSCallsChainsWith typedef Test CommandStreamReceiverCQFlushTaskTests; HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSizeCSRTraffic) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStreamReceiver = commandQueue.getGpgpuCommandStreamReceiver(); // NOTE: This test attempts to reserve the maximum amount @@ -872,7 +872,7 @@ HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSi HWTEST_F(CommandStreamReceiverFlushTaskTests, blockingFlushTaskWithOnlyPipeControl) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); @@ -919,7 +919,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, blockingFlushTaskWithOnlyPipeContr HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWithDCFlush) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); configureCSRtoNonDirtyState(); auto &commandStreamReceiver = commandQueue.getGpgpuCommandStreamReceiver(); @@ -971,8 +971,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWit HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelRequiringDCFlushWhenUnblockedThenDCFlushIsAdded) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - MockContext ctx(pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); commandStreamReceiver.timestampPacketWriteEnabled = false; cl_event blockingEvent; @@ -1018,7 +1018,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWhenCallFlushTas auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); @@ -1049,4 +1049,4 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWhenCallFlushTas *pDevice); EXPECT_EQ(UnitTestHelper::getAppropriateThreadArbitrationPolicy(dispatchFlags.threadArbitrationPolicy), mockCsr->requiredThreadArbitrationPolicy); -} \ No newline at end of file +} diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp index 8d972adc57..7192a9522a 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -34,8 +34,8 @@ typedef UltCommandStreamReceiverTest CommandStreamReceiverFlushTaskTests; HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelNotRequiringDCFlushWhenUnblockedThenDCFlushIsNotAdded) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - MockContext ctx(pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); commandStreamReceiver.timestampPacketWriteEnabled = false; cl_event blockingEvent; @@ -78,7 +78,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelNotRequiringDCFl } HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskWithTaskCSPassedAsCommandStreamParam) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); auto &commandStreamTask = commandQueue.getCS(1024); @@ -102,8 +102,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskWithTaskCSPassedAsCommand } HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenEmptyQueue) { - MockContext ctx(pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); uint32_t taskCount = 0; taskLevel = taskCount; @@ -122,9 +122,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenEmptyQueue) { } HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenNonDcFlushWithInitialTaskCountZero) { - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); size_t GWS = 1; @@ -151,9 +151,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenNonDcFlushWithIni } HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenDcFlush) { - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); size_t GWS = 1; size_t tempBuffer[] = {0, 1, 2}; @@ -207,10 +207,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenDcFlush) { HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenPowerOfTwoGlobalWorkSizeAndNullLocalWorkgroupSizeWhenEnqueueKernelIsCalledThenGpGpuWalkerHasOptimalSIMDmask) { typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER; - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); size_t GWS = 1024; - CommandQueueHw commandQueue(&ctx, pDevice, 0); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); commandQueue.enqueueKernel(kernel, 1, nullptr, &GWS, nullptr, 0, nullptr, nullptr); auto &commandStreamTask = commandQueue.getCS(1024); parseCommands(commandStreamTask, 0); @@ -224,8 +224,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenPowerOfTwo } HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenEventIsQueried) { - MockContext ctx(pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); cl_event event = nullptr; Event *pEvent; @@ -263,8 +263,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, TrackSentTagsWhenEventIsQueried) { HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenNonBlockingMapWhenFinishIsCalledThenNothingIsSubmittedToTheHardware) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - MockContext ctx(pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); size_t tempBuffer[] = {0, 1, 2}; cl_int retVal; @@ -300,8 +300,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, GivenFlushedCallRequiringDCFlushWhenBlockingEnqueueIsCalledThenPipeControlWithDCFlushIsAdded) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - MockContext ctx(pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); cl_event event = nullptr; auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); @@ -366,9 +366,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDefaultCommandStreamReceiverT HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousSLML3WasSentThenDontProgramL3) { typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; size_t GWS = 1; - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); @@ -548,9 +548,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenTwoConsecu typedef typename PARSE::MEDIA_VFE_STATE MEDIA_VFE_STATE; typedef typename PARSE::STATE_BASE_ADDRESS STATE_BASE_ADDRESS; - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); @@ -662,9 +662,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenNDRangeKer typedef typename PARSE::MEDIA_VFE_STATE MEDIA_VFE_STATE; typedef typename PARSE::STATE_BASE_ADDRESS STATE_BASE_ADDRESS; - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); @@ -1054,7 +1054,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenSamplerCacheFlushSentT } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateWhenflushTaskIsCalledThenNoFlushIsCalled) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1078,7 +1078,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateWhenflushTa } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateAndBatchingModeWhenflushTaskIsCalledWithDisabledPreemptionThenSubmissionIsNotRecorded) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp index 214e81ad6c..7752fbaa07 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp @@ -31,7 +31,7 @@ typedef UltCommandStreamReceiverTest CommandStreamReceiverFlushTaskTests; HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTaskIsCalledThenNothingIsSubmittedToTheHwAndSubmissionIsRecorded) { typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -88,7 +88,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndTwoRecord typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; typedef typename FamilyType::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -139,7 +139,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; typedef typename FamilyType::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -201,7 +201,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; typedef typename FamilyType::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -266,7 +266,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTaskIsCalledTwiceThenNothingIsSubmittedToTheHwAndTwoSubmissionAreRecorded) { typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto initialBase = commandStream.getCpuBase(); @@ -342,7 +342,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenRecordedBatchBufferIsBeingSubmittedThenFlushIsCalledWithRecordedCommandBuffer) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -419,7 +419,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrCreatedWithDedicatedDebugF } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenBlockingCommandIsSendThenItIsFlushedAndNotBatched) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -477,7 +477,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNothingToFlushWhenFlushTaskCa } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTaskIsCalledThenFlushedTaskCountIsNotModifed) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -508,7 +508,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeWhenFlushTaskIsCalledThenFlushedTaskCountIsModifed) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); @@ -531,7 +531,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeWhenFlushTask } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenWaitForTaskCountIsCalledWithTaskCountThatWasNotYetFlushedThenBatchedCommandBuffersAreSubmitted) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -571,7 +571,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenWaitForT } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenEnqueueIsMadeThenCurrentMemoryUsedIsTracked) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -611,7 +611,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenEnqueueI } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenSusbsequentEnqueueIsMadeThenOnlyNewResourcesAreTrackedForMemoryUsage) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -667,7 +667,7 @@ struct MockedMemoryManager : public OsAgnosticMemoryManager { }; HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalResourceUsedExhaustsTheBudgetThenDoImplicitFlush) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); auto mockedMemoryManager = new MockedMemoryManager(*executionEnvironment); @@ -729,7 +729,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTwoTasksArePassedWithTheSameLevelThenThereIsNoPipeControlBetweenThemAfterFlush) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -810,7 +810,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushIsNotRequiredThenItIsNotSet) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -838,7 +838,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenCommandAreSubmittedThenDcFlushIsAdded) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -869,7 +869,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenCommandA } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWithOutOfOrderModeFisabledWhenCommandAreSubmittedThenDcFlushIsAdded) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -900,7 +900,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWithOutOfOrd } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushIsRequiredThenPipeControlIsNotRegistredForNooping) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -933,7 +933,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlThenDcFlushIsEnabled) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -972,7 +972,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlWhendDcFlu DebugManagerStateRestore debugRestorer; DebugManager.flags.DisableDcFlushInEpilogue.set(true); - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1007,7 +1007,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlWhendDcFlu HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndOoqFlagSetToFalseWhenTwoTasksArePassedWithTheSameLevelThenThereIsPipeControlBetweenThemAfterFlush) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1066,7 +1066,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndOoqFlagSetToFalseWhenTimestampPacketWriteIsEnabledThenNoopPipeControl) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1105,7 +1105,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndOoqFlagSe } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenPipeControlForNoopAddressIsNullThenPipeControlIsNotNooped) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1167,7 +1167,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenPipeCont HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenThreeTasksArePassedWithTheSameLevelThenThereIsNoPipeControlBetweenThemAfterFlush) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1308,7 +1308,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenTemporaryAndReusableAl HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetToLowWhenFlushTaskIsCalledThenThrottleIsSetInBatchBuffer) { typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1340,7 +1340,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetToMediumWhenFlushTaskIsCalledThenThrottleIsSetInBatchBuffer) { typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1371,9 +1371,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandQueueWithThrottleHintWhenFlushingThenPassThrottleHintToCsr) { - MockContext context(pDevice); + MockContext context(pClDevice); cl_queue_properties properties[] = {CL_QUEUE_THROTTLE_KHR, CL_QUEUE_THROTTLE_LOW_KHR, 0}; - CommandQueueHw commandQueue(&context, pDevice, properties); + CommandQueueHw commandQueue(&context, pClDevice, properties); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(mockCsr); @@ -1389,7 +1389,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandQueueWithThrottleHintW HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetToHighWhenFlushTaskIsCalledThenThrottleIsSetInBatchBuffer) { typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1469,7 +1469,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpilogueRequiredFlagWhenTaskI } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithNewSliceCountWhenFlushTaskThenNewSliceCountIsSet) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -1523,7 +1523,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelWhenItIsUnblocke pDevice->resetCommandStreamReceiver(csr); uint32_t numGrfRequired = 666u; - auto pCmdQ = std::make_unique(&mockContext, pDevice, nullptr); + auto pCmdQ = std::make_unique(&mockContext, pClDevice, nullptr); auto mockProgram = std::make_unique(*pDevice->getExecutionEnvironment(), &mockContext, false); std::unique_ptr pKernel(MockKernel::create(*pDevice, mockProgram.get(), numGrfRequired)); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp index bb0d170fbd..a6a690b1c1 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -59,7 +59,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenCsrInBatchingModeThreeRe typedef typename FamilyType::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START; typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -126,7 +126,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenCsrInBatchingModeThreeRe HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenAddPatchInfoCommentsForAUBDumpIsNotSetThenAddPatchInfoDataIsNotCollected) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -153,7 +153,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA DebugManagerStateRestore dbgRestore; DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true); - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -259,7 +259,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch DebugManagerStateRestore dbgRestore; DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true); - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); std::unique_ptr> mockCsr(new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex())); @@ -278,7 +278,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch } HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatchInfoCollectionDisabledWhenScratchSpaceIsProgrammedThenPatchInfoIsNotCollected) { - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); std::unique_ptr> mockCsr(new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex())); @@ -299,7 +299,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch DebugManagerStateRestore dbgRestore; DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true); - CommandQueueHw commandQueue(nullptr, pDevice, 0); + CommandQueueHw commandQueue(nullptr, pClDevice, 0); auto &commandStream = commandQueue.getCS(4096u); std::unique_ptr> mockCsr(new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex())); diff --git a/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp b/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp index 5a91ebbfbb..13a364c23f 100644 --- a/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp @@ -66,7 +66,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenPreambleSentAndTh HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenNotSentStateSipWhenFirstTaskIsFlushedThenStateSipCmdIsAddedAndIsStateSipSentSetToTrue) { using STATE_SIP = typename FamilyType::STATE_SIP; - auto mockDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); if (mockDevice->getHardwareInfo().capabilityTable.defaultPreemptionMode == PreemptionMode::MidThread) { mockDevice->setPreemptionMode(PreemptionMode::MidThread); @@ -90,7 +90,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenNotSentStateSipWh heap, 0, dispatchFlags, - *mockDevice); + mockDevice->getDevice()); EXPECT_TRUE(csr.isStateSipSent); @@ -314,7 +314,7 @@ struct BcsTests : public CommandStreamReceiverHwTest { engine->osContext->incRefInternal(); csr.setupContext(*engine->osContext); - context = std::make_unique(pDevice); + context = std::make_unique(pClDevice); } void TearDown() override { diff --git a/unit_tests/command_stream/command_stream_receiver_hw_tests.inl b/unit_tests/command_stream/command_stream_receiver_hw_tests.inl index 4984ca6db8..cedb81260b 100644 --- a/unit_tests/command_stream/command_stream_receiver_hw_tests.inl +++ b/unit_tests/command_stream/command_stream_receiver_hw_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,9 +31,9 @@ void CommandStreamReceiverHwTest::givenKernelWithSlmWhenPreviousNOSLM typedef typename GfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL; size_t GWS = 1; - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); @@ -72,9 +72,9 @@ void CommandStreamReceiverHwTest::givenBlockedKernelWithSlmWhenPrevio typedef typename GfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; size_t GWS = 1; - MockContext ctx(pDevice); - MockKernelWithInternals kernel(*pDevice); - CommandQueueHw commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); cl_event blockingEvent; diff --git a/unit_tests/command_stream/submissions_aggregator_tests.cpp b/unit_tests/command_stream/submissions_aggregator_tests.cpp index 3691fae3d3..6484097b4c 100644 --- a/unit_tests/command_stream/submissions_aggregator_tests.cpp +++ b/unit_tests/command_stream/submissions_aggregator_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -574,7 +574,7 @@ TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentSliceCountSetti struct SubmissionsAggregatorTests : public ::testing::Test { void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); context.reset(new MockContext(device.get())); } @@ -583,7 +583,7 @@ struct SubmissionsAggregatorTests : public ::testing::Test { newCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; }; diff --git a/unit_tests/command_stream/tbx_command_stream_tests.cpp b/unit_tests/command_stream/tbx_command_stream_tests.cpp index 91cadbd2db..b9ea82f1bb 100644 --- a/unit_tests/command_stream/tbx_command_stream_tests.cpp +++ b/unit_tests/command_stream/tbx_command_stream_tests.cpp @@ -842,7 +842,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA aubSubCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle; tbxCsr.subCaptureManager = std::unique_ptr(aubSubCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -867,7 +867,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA aubSubCaptureManagerMock->setSubCaptureToggleActive(true); tbxCsr.subCaptureManager = std::unique_ptr(aubSubCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -892,7 +892,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA aubSubCaptureManagerMock->setSubCaptureToggleActive(true); tbxCsr.subCaptureManager = std::unique_ptr(aubSubCaptureManagerMock); - MockKernelWithInternals kernelInternals(*pDevice); + MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; MockMultiDispatchInfo multiDispatchInfo(kernel); @@ -921,7 +921,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenDispatchBlitEnqueueThenProcessCor DebugManager.flags.EnableBlitterOperationsSupport.set(1); DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.set(1); - MockContext context(pDevice); + MockContext context(pClDevice); MockTbxCsr tbxCsr0{*pDevice->executionEnvironment}; tbxCsr0.initializeTagAllocation(); @@ -936,7 +936,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenDispatchBlitEnqueueThenProcessCor tbxCsr1.setupContext(osContext0); EngineControl engineControl1{&tbxCsr1, &osContext1}; - MockCommandQueueHw cmdQ(&context, pDevice, nullptr); + MockCommandQueueHw cmdQ(&context, pClDevice, nullptr); cmdQ.gpgpuEngine = &engineControl0; cmdQ.bcsEngine = &engineControl1; diff --git a/unit_tests/context/context_multi_device_tests.cpp b/unit_tests/context/context_multi_device_tests.cpp index 77e730d768..a62d512bfd 100644 --- a/unit_tests/context/context_multi_device_tests.cpp +++ b/unit_tests/context/context_multi_device_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,18 +16,18 @@ using namespace NEO; TEST(ContextMultiDevice, singleDevice) { cl_device_id devices[] = { - MockDevice::createWithNewExecutionEnvironment(nullptr)}; + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}}; auto numDevices = static_cast(arrayCount(devices)); auto retVal = CL_SUCCESS; - auto pContext = Context::create(nullptr, DeviceVector(devices, numDevices), + auto pContext = Context::create(nullptr, ClDeviceVector(devices, numDevices), nullptr, nullptr, retVal); ASSERT_NE(nullptr, pContext); auto numDevicesReturned = pContext->getNumDevices(); EXPECT_EQ(numDevices, numDevicesReturned); - DeviceVector ctxDevices; + ClDeviceVector ctxDevices; for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) { ctxDevices.push_back(pContext->getDevice(deviceOrdinal)); } @@ -35,7 +35,7 @@ TEST(ContextMultiDevice, singleDevice) { delete pContext; for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) { - auto pDevice = (Device *)devices[deviceOrdinal]; + auto pDevice = (ClDevice *)devices[deviceOrdinal]; ASSERT_NE(nullptr, pDevice); EXPECT_EQ(pDevice, ctxDevices[deviceOrdinal]); @@ -45,26 +45,26 @@ TEST(ContextMultiDevice, singleDevice) { TEST(ContextMultiDevice, eightDevices) { cl_device_id devices[] = { - MockDevice::createWithNewExecutionEnvironment(nullptr), - MockDevice::createWithNewExecutionEnvironment(nullptr), - MockDevice::createWithNewExecutionEnvironment(nullptr), - MockDevice::createWithNewExecutionEnvironment(nullptr), - MockDevice::createWithNewExecutionEnvironment(nullptr), - MockDevice::createWithNewExecutionEnvironment(nullptr), - MockDevice::createWithNewExecutionEnvironment(nullptr), - MockDevice::createWithNewExecutionEnvironment(nullptr)}; + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}, + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}, + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}, + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}, + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}, + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}, + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}, + new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}}; auto numDevices = static_cast(arrayCount(devices)); ASSERT_EQ(8u, numDevices); auto retVal = CL_SUCCESS; - auto pContext = Context::create(nullptr, DeviceVector(devices, numDevices), + auto pContext = Context::create(nullptr, ClDeviceVector(devices, numDevices), nullptr, nullptr, retVal); ASSERT_NE(nullptr, pContext); auto numDevicesReturned = pContext->getNumDevices(); EXPECT_EQ(numDevices, numDevicesReturned); - DeviceVector ctxDevices; + ClDeviceVector ctxDevices; for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) { ctxDevices.push_back(pContext->getDevice(deviceOrdinal)); } @@ -72,7 +72,7 @@ TEST(ContextMultiDevice, eightDevices) { delete pContext; for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) { - auto pDevice = (Device *)devices[deviceOrdinal]; + auto pDevice = (ClDevice *)devices[deviceOrdinal]; ASSERT_NE(nullptr, pDevice); EXPECT_EQ(pDevice, ctxDevices[deviceOrdinal]); diff --git a/unit_tests/context/context_negative_tests.cpp b/unit_tests/context/context_negative_tests.cpp index 7c055f8e4e..03e96493a0 100644 --- a/unit_tests/context/context_negative_tests.cpp +++ b/unit_tests/context/context_negative_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,12 +22,12 @@ using namespace NEO; typedef Test ContextFailureInjection; TEST_F(ContextFailureInjection, failedAllocationInjection) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); cl_device_id deviceID = device.get(); InjectedFunction method = [deviceID](size_t failureIndex) { auto retVal = CL_INVALID_VALUE; - auto context = Context::create(nullptr, DeviceVector(&deviceID, 1), nullptr, + auto context = Context::create(nullptr, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); if (MemoryManagement::nonfailingAllocation == failureIndex) { @@ -45,7 +45,7 @@ TEST_F(ContextFailureInjection, failedAllocationInjection) { } TEST(InvalidPropertyContextTest, GivenInvalidPropertiesWhenContextIsCreatedThenErrorIsReturned) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); cl_device_id deviceID = device.get(); auto pPlatform = NEO::platform(); cl_platform_id pid[1]; @@ -54,14 +54,14 @@ TEST(InvalidPropertyContextTest, GivenInvalidPropertiesWhenContextIsCreatedThenE cl_context_properties invalidProperties2[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], (cl_context_properties)0xdeadbeef, 0x10000, 0}; cl_int retVal = 0; - auto context = Context::create(invalidProperties, DeviceVector(&deviceID, 1), nullptr, + auto context = Context::create(invalidProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_INVALID_PROPERTY, retVal); EXPECT_EQ(nullptr, context); delete context; - context = Context::create(invalidProperties2, DeviceVector(&deviceID, 1), nullptr, + context = Context::create(invalidProperties2, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_INVALID_PROPERTY, retVal); diff --git a/unit_tests/context/context_tests.cpp b/unit_tests/context/context_tests.cpp index aae0cfb6c8..e32145dbf8 100644 --- a/unit_tests/context/context_tests.cpp +++ b/unit_tests/context/context_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -54,7 +54,7 @@ struct ContextTest : public PlatformFixture, properties[1] = (cl_context_properties)platform; properties[2] = 0; - context = Context::create(properties, DeviceVector(devices, num_devices), nullptr, nullptr, retVal); + context = Context::create(properties, ClDeviceVector(devices, num_devices), nullptr, nullptr, retVal); ASSERT_NE(nullptr, context); } @@ -109,12 +109,12 @@ TEST_F(ContextTest, specialQueue) { } TEST_F(ContextTest, setSpecialQueue) { - MockContext context((Device *)devices[0], true); + MockContext context((ClDevice *)devices[0], true); auto specialQ = context.getSpecialQueue(); EXPECT_EQ(specialQ, nullptr); - auto cmdQ = new CommandQueue(&context, (Device *)devices[0], 0); + auto cmdQ = new CommandQueue(&context, (ClDevice *)devices[0], 0); context.setSpecialQueue(cmdQ); specialQ = context.getSpecialQueue(); EXPECT_NE(specialQ, nullptr); @@ -129,7 +129,7 @@ TEST_F(ContextTest, defaultQueue) { } TEST_F(ContextTest, givenCmdQueueWithoutContextWhenBeingCreatedNextDeletedThenContextRefCountShouldNeitherBeIncrementedNorNextDecremented) { - MockContext context((Device *)devices[0]); + MockContext context((ClDevice *)devices[0]); EXPECT_EQ(1, context.getRefInternalCount()); auto cmdQ1 = new CommandQueue(); @@ -138,7 +138,7 @@ TEST_F(ContextTest, givenCmdQueueWithoutContextWhenBeingCreatedNextDeletedThenCo delete cmdQ1; EXPECT_EQ(1, context.getRefInternalCount()); - auto cmdQ2 = new CommandQueue(nullptr, (Device *)devices[0], 0); + auto cmdQ2 = new CommandQueue(nullptr, (ClDevice *)devices[0], 0); EXPECT_EQ(1, context.getRefInternalCount()); delete cmdQ2; @@ -146,7 +146,7 @@ TEST_F(ContextTest, givenCmdQueueWithoutContextWhenBeingCreatedNextDeletedThenCo } TEST_F(ContextTest, givenDeviceQueueWithoutContextWhenBeingCreatedNextDeletedThenContextRefCountShouldNeitherBeIncrementedNorNextDecremented) { - MockContext context((Device *)devices[0]); + MockContext context((ClDevice *)devices[0]); EXPECT_EQ(1, context.getRefInternalCount()); auto cmdQ1 = new DeviceQueue(); @@ -156,7 +156,7 @@ TEST_F(ContextTest, givenDeviceQueueWithoutContextWhenBeingCreatedNextDeletedThe EXPECT_EQ(1, context.getRefInternalCount()); cl_queue_properties properties = 0; - auto cmdQ2 = new DeviceQueue(nullptr, (Device *)devices[0], properties); + auto cmdQ2 = new DeviceQueue(nullptr, (ClDevice *)devices[0], properties); EXPECT_EQ(1, context.getRefInternalCount()); delete cmdQ2; @@ -164,10 +164,10 @@ TEST_F(ContextTest, givenDeviceQueueWithoutContextWhenBeingCreatedNextDeletedThe } TEST_F(ContextTest, givenCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) { - MockContext context((Device *)devices[0]); + MockContext context((ClDevice *)devices[0]); EXPECT_EQ(1, context.getRefInternalCount()); - auto cmdQ = new CommandQueue(&context, (Device *)devices[0], 0); + auto cmdQ = new CommandQueue(&context, (ClDevice *)devices[0], 0); EXPECT_EQ(2, context.getRefInternalCount()); delete cmdQ; @@ -175,11 +175,11 @@ TEST_F(ContextTest, givenCmdQueueWithContextWhenBeingCreatedNextDeletedThenConte } TEST_F(ContextTest, givenDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) { - MockContext context((Device *)devices[0]); + MockContext context((ClDevice *)devices[0]); EXPECT_EQ(1, context.getRefInternalCount()); cl_queue_properties properties = 0; - auto cmdQ = new DeviceQueue(&context, (Device *)devices[0], properties); + auto cmdQ = new DeviceQueue(&context, (ClDevice *)devices[0], properties); EXPECT_EQ(2, context.getRefInternalCount()); delete cmdQ; @@ -187,11 +187,11 @@ TEST_F(ContextTest, givenDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThe } TEST_F(ContextTest, givenDefaultDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) { - MockContext context((Device *)devices[0]); + MockContext context((ClDevice *)devices[0]); EXPECT_EQ(1, context.getRefInternalCount()); cl_queue_properties properties = 0; - auto cmdQ = new DeviceQueue(&context, (Device *)devices[0], properties); + auto cmdQ = new DeviceQueue(&context, (ClDevice *)devices[0], properties); context.setDefaultDeviceQueue(cmdQ); EXPECT_EQ(2, context.getRefInternalCount()); @@ -200,20 +200,20 @@ TEST_F(ContextTest, givenDefaultDeviceCmdQueueWithContextWhenBeingCreatedNextDel } TEST_F(ContextTest, givenContextWhenItIsCreatedFromDeviceThenItAddsRefCountToThisDevice) { - auto device = castToObject(devices[0]); + auto device = castToObject(devices[0]); EXPECT_EQ(2, device->getRefInternalCount()); cl_device_id deviceID = devices[0]; - std::unique_ptr context(Context::create(0, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); + std::unique_ptr context(Context::create(0, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); EXPECT_EQ(3, device->getRefInternalCount()); context.reset(nullptr); EXPECT_EQ(2, device->getRefInternalCount()); } TEST_F(ContextTest, givenContextWhenItIsCreatedFromMultipleDevicesThenItAddsRefCountToThoseDevices) { - auto device = castToObject(devices[0]); + auto device = castToObject(devices[0]); EXPECT_EQ(2, device->getRefInternalCount()); - DeviceVector devicesVector; + ClDeviceVector devicesVector; devicesVector.push_back(device); devicesVector.push_back(device); @@ -224,10 +224,10 @@ TEST_F(ContextTest, givenContextWhenItIsCreatedFromMultipleDevicesThenItAddsRefC } TEST_F(ContextTest, givenSpecialCmdQueueWithContextWhenBeingCreatedNextAutoDeletedThenContextRefCountShouldNeitherBeIncrementedNorNextDecremented) { - MockContext context((Device *)devices[0], true); + MockContext context((ClDevice *)devices[0], true); EXPECT_EQ(1, context.getRefInternalCount()); - auto cmdQ = new CommandQueue(&context, (Device *)devices[0], 0); + auto cmdQ = new CommandQueue(&context, (ClDevice *)devices[0], 0); context.overrideSpecialQueueAndDecrementRefCount(cmdQ); EXPECT_EQ(1, context.getRefInternalCount()); @@ -235,10 +235,10 @@ TEST_F(ContextTest, givenSpecialCmdQueueWithContextWhenBeingCreatedNextAutoDelet } TEST_F(ContextTest, givenSpecialCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldNeitherBeIncrementedNorNextDecremented) { - MockContext context((Device *)devices[0], true); + MockContext context((ClDevice *)devices[0], true); EXPECT_EQ(1, context.getRefInternalCount()); - auto cmdQ = new CommandQueue(&context, (Device *)devices[0], 0); + auto cmdQ = new CommandQueue(&context, (ClDevice *)devices[0], 0); context.overrideSpecialQueueAndDecrementRefCount(cmdQ); EXPECT_EQ(1, context.getRefInternalCount()); @@ -257,14 +257,14 @@ TEST_F(ContextTest, GivenInteropSyncParamWhenCreateContextThenSetContextParam) { cl_context_properties validProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], CL_CONTEXT_INTEROP_USER_SYNC, 1, 0}; cl_int retVal = CL_SUCCESS; - auto context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + auto context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); EXPECT_TRUE(context->getInteropUserSyncEnabled()); delete context; validProperties[3] = 0; // false - context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); @@ -305,11 +305,11 @@ TEST(Context, givenFtrSvmFalseWhenContextIsCreatedThenSVMAllocsManagerIsNotCreat auto hwInfo = executionEnvironment->getMutableHardwareInfo(); hwInfo->capabilityTable.ftrSvm = false; - std::unique_ptr device(MockDevice::createWithExecutionEnvironment(hwInfo, executionEnvironment, 0)); + auto device = std::make_unique(MockDevice::createWithExecutionEnvironment(hwInfo, executionEnvironment, 0)); cl_device_id clDevice = device.get(); cl_int retVal = CL_SUCCESS; - auto context = std::unique_ptr(Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); + auto context = std::unique_ptr(Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); ASSERT_NE(nullptr, context); auto svmManager = context->getSVMAllocsManager(); EXPECT_EQ(nullptr, svmManager); @@ -323,11 +323,11 @@ TEST(MultiDeviceContextTest, givenContextWithMultipleDevicesWhenGettingTotalNumb numDevicesBackup = numDevices; DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices); platform()->initialize(); - auto device0 = platform()->getDevice(0); - auto device1 = platform()->getDevice(1); + auto device0 = platform()->getClDevice(0); + auto device1 = platform()->getClDevice(1); cl_device_id clDevices[2]{device0, device1}; - DeviceVector deviceVector(clDevices, 2); + ClDeviceVector deviceVector(clDevices, 2); cl_int retVal = CL_OUT_OF_HOST_MEMORY; auto context = std::unique_ptr(Context::create(nullptr, deviceVector, nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -342,7 +342,7 @@ class ContextWithAsyncDeleterTest : public ::testing::WithParamInterface, public: void SetUp() override { memoryManager = new MockMemoryManager(); - device = new MockDevice; + device = new MockClDevice{new MockDevice}; deleter = new MockDeferredDeleter(); device->injectMemoryManager(memoryManager); memoryManager->setDeferredDeleter(deleter); @@ -353,13 +353,13 @@ class ContextWithAsyncDeleterTest : public ::testing::WithParamInterface, Context *context; MockMemoryManager *memoryManager; MockDeferredDeleter *deleter; - MockDevice *device; + MockClDevice *device; }; TEST_P(ContextWithAsyncDeleterTest, givenContextWithMemoryManagerWhenAsyncDeleterIsEnabledThenUsesDeletersMethods) { - cl_device_id clDevice = static_cast(device); + cl_device_id clDevice = device; cl_int retVal; - DeviceVector deviceVector((cl_device_id *)&clDevice, 1); + ClDeviceVector deviceVector(&clDevice, 1); bool asyncDeleterEnabled = GetParam(); memoryManager->overrideAsyncDeleterFlag(asyncDeleterEnabled); diff --git a/unit_tests/context/driver_diagnostics_enqueue_tests.cpp b/unit_tests/context/driver_diagnostics_enqueue_tests.cpp index d78c13fe2e..c083cc7108 100644 --- a/unit_tests/context/driver_diagnostics_enqueue_tests.cpp +++ b/unit_tests/context/driver_diagnostics_enqueue_tests.cpp @@ -794,7 +794,7 @@ TEST_F(PerformanceHintEnqueueTest, GivenKernelWithCoherentPtrWhenEnqueueKernelIs size_t preferredWorkGroupSize[3]; size_t globalWorkGroupSize[3] = {1, 1, 1}; auto maxWorkGroupSize = static_cast(pPlatform->getDevice(0)->getDeviceInfo().maxWorkGroupSize); - MockKernelWithInternals mockKernel(*pPlatform->getDevice(0), context); + MockKernelWithInternals mockKernel(*pPlatform->getClDevice(0), context); Kernel::SimpleKernelArgInfo kernelArgInfo; if (DebugManager.flags.EnableComputeWorkSizeND.get()) { diff --git a/unit_tests/context/driver_diagnostics_tests.cpp b/unit_tests/context/driver_diagnostics_tests.cpp index 4b23b0c8c9..c4a8b62161 100644 --- a/unit_tests/context/driver_diagnostics_tests.cpp +++ b/unit_tests/context/driver_diagnostics_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -44,7 +44,7 @@ TEST_P(VerboseLevelTest, GivenVerboseLevelWhenProvidedHintLevelIsSameOrAllThenCa cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, (cl_context_properties)diagnosticsLevel, 0}; retVal = CL_SUCCESS; - auto context = Context::create(validProperties, DeviceVector(&deviceID, 1), callbackFunction, (void *)userData, retVal); + auto context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), callbackFunction, (void *)userData, retVal); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); @@ -66,7 +66,7 @@ TEST_P(VerboseLevelTest, GivenVerboseLevelAllWhenAnyHintIsProvidedThenCallbackFu cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; retVal = CL_SUCCESS; - auto context = Context::create(validProperties, DeviceVector(&deviceID, 1), callbackFunction, (void *)userData, retVal); + auto context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), callbackFunction, (void *)userData, retVal); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); @@ -110,7 +110,7 @@ TEST_P(PerformanceHintCommandQueueTest, GivenProfilingFlagAndPreemptionFlagWhenC if (profilingEnabled) { properties = CL_QUEUE_PROFILING_ENABLE; } - cmdQ = clCreateCommandQueue(context, device, properties, &retVal); + cmdQ = clCreateCommandQueue(context, clDevice, properties, &retVal); ASSERT_NE(nullptr, cmdQ); ASSERT_EQ(CL_SUCCESS, retVal); @@ -135,7 +135,7 @@ TEST_P(PerformanceHintCommandQueueTest, GivenEnabledProfilingFlagAndSupportedPre properties[0] = CL_QUEUE_PROPERTIES; properties[1] = CL_QUEUE_PROFILING_ENABLE; } - cmdQ = clCreateCommandQueueWithProperties(context, device, properties, &retVal); + cmdQ = clCreateCommandQueueWithProperties(context, clDevice, properties, &retVal); ASSERT_NE(nullptr, cmdQ); ASSERT_EQ(CL_SUCCESS, retVal); @@ -242,7 +242,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndEmptyDispatchinfoAndEnableCompute TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableComputeWorkSizeNDIsDefaultWhenProvideLocalWorkGroupSizeIsCalledThenItDoesntCrash) { - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -251,7 +251,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu bool isWorkGroupSizeEnabled = DebugManager.flags.EnableComputeWorkSizeND.get(); DebugManager.flags.EnableComputeWorkSizeND.set(true); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -261,7 +261,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu bool isWorkGroupSizeEnabled = DebugManager.flags.EnableComputeWorkSizeND.get(); DebugManager.flags.EnableComputeWorkSizeND.set(false); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -270,7 +270,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableComputeWorkSizeSquaredIsDefaultWhenProvideLocalWorkGroupSizeIsCalledThenItDoesntCrash) { - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -280,7 +280,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(true); DebugManager.flags.EnableComputeWorkSizeND.set(false); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -290,7 +290,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(false); DebugManager.flags.EnableComputeWorkSizeND.set(false); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -298,7 +298,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeSquaredIsDefaultWhenProvideLocalWorkGroupSizeIsCalledReturnValue) { - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -308,7 +308,7 @@ TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeS DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(true); DebugManager.flags.EnableComputeWorkSizeND.set(false); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 2, {32, 32, 1}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -318,7 +318,7 @@ TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeS DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(false); DebugManager.flags.EnableComputeWorkSizeND.set(false); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); DispatchInfo invalidDispatchInfo(mockKernel, 2, {32, 32, 1}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); @@ -347,10 +347,10 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticValueWhenContextIsCreatedT auto hintLevel = 1; DebugManager.flags.PrintDriverDiagnostics.set(hintLevel); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); cl_device_id clDevice = pDevice; - auto context = Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal); + auto context = Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal); EXPECT_TRUE(!!context->isProvidingPerformanceHints()); auto driverDiagnostics = context->driverDiagnostics; @@ -364,10 +364,10 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenHintI auto hintLevel = 255; DebugManager.flags.PrintDriverDiagnostics.set(hintLevel); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); cl_device_id clDevice = pDevice; - auto context = Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal); + auto context = Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal); testing::internal::CaptureStdout(); auto buffer = Buffer::create( @@ -390,10 +390,10 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsAndBadHintLevelWhenAction auto hintLevel = 8; DebugManager.flags.PrintDriverDiagnostics.set(hintLevel); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); cl_device_id clDevice = pDevice; - auto context = Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal); + auto context = Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal); testing::internal::CaptureStdout(); auto buffer = Buffer::create( @@ -415,11 +415,11 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenConte auto hintLevel = 1; DebugManager.flags.PrintDriverDiagnostics.set(hintLevel); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); cl_device_id clDevice = pDevice; cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; auto retValue = CL_SUCCESS; - auto context = Context::create(validProperties, DeviceVector(&clDevice, 1), callbackFunction, (void *)userData, retVal); + auto context = Context::create(validProperties, ClDeviceVector(&clDevice, 1), callbackFunction, (void *)userData, retVal); EXPECT_EQ(CL_SUCCESS, retValue); auto driverDiagnostics = context->driverDiagnostics; ASSERT_NE(nullptr, driverDiagnostics); @@ -433,7 +433,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF DebugManagerStateRestore dbgRestore; DebugManager.flags.PrintDriverDiagnostics.set(1); - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); MockBuffer buffer; cl_mem clMem = &buffer; @@ -463,12 +463,12 @@ TEST_F(PerformanceHintTest, given64bitCompressedBufferWhenItsCreatedThenProperPe HardwareInfo hwInfo = context->getDevice(0)->getHardwareInfo(); hwInfo.capabilityTable.ftrRenderCompressedBuffers = true; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); - cl_device_id deviceId = static_cast(device.get()); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + cl_device_id deviceId = device.get(); size_t size = 8192u; cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; - auto context = std::unique_ptr(Context::create(validProperties, DeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); + auto context = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); context->isSharedContext = false; auto buffer = std::unique_ptr(Buffer::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags((1 << 21), 0, 0), (1 << 21), 0, size, static_cast(NULL), retVal)); snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[BUFFER_IS_COMPRESSED], buffer.get()); @@ -486,14 +486,14 @@ TEST_F(PerformanceHintTest, givenUncompressedBufferWhenItsCreatedThenProperPerfo HardwareInfo hwInfo = context->getDevice(0)->getHardwareInfo(); hwInfo.capabilityTable.ftrRenderCompressedBuffers = true; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); - cl_device_id deviceId = static_cast(device.get()); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + cl_device_id deviceId = device.get(); MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0); size_t size = 0u; cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; - auto context = std::unique_ptr(Context::create(validProperties, DeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); + auto context = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); std::unique_ptr buffer; bool isCompressed = true; if (context->getMemoryManager()) { @@ -519,11 +519,11 @@ TEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerforma HardwareInfo hwInfo = context->getDevice(0)->getHardwareInfo(); hwInfo.capabilityTable.ftrRenderCompressedImages = true; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); - cl_device_id deviceId = static_cast(device.get()); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + cl_device_id deviceId = device.get(); cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; - auto context = std::unique_ptr(Context::create(validProperties, DeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); + auto context = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); const size_t width = 5; const size_t height = 3; @@ -582,11 +582,11 @@ TEST_F(PerformanceHintTest, givenImageWithNoGmmWhenItsCreatedThenNoPerformanceHi HardwareInfo hwInfo = context->getDevice(0)->getHardwareInfo(); hwInfo.capabilityTable.ftrRenderCompressedImages = true; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); - cl_device_id deviceId = static_cast(device.get()); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + cl_device_id deviceId = device.get(); cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; - auto context = std::unique_ptr(Context::create(validProperties, DeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); + auto context = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); const size_t width = 5; const size_t height = 3; @@ -639,11 +639,11 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor HardwareInfo hwInfo = context->getDevice(0)->getHardwareInfo(); hwInfo.capabilityTable.ftrRenderCompressedImages = true; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); - cl_device_id deviceId = static_cast(device.get()); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + cl_device_id deviceId = device.get(); cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; - auto context = std::unique_ptr(Context::create(validProperties, DeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); + auto context = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); const size_t width = 5; const size_t height = 3; @@ -700,7 +700,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor TEST_P(PerformanceHintKernelTest, GivenSpillFillWhenKernelIsInitializedThenContextProvidesProperHint) { - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); auto size = zeroSized ? 0 : 1024; MockKernelWithInternals mockKernel(*pDevice, context); SPatchMediaVFEState mediaVFEstate; @@ -719,7 +719,7 @@ TEST_P(PerformanceHintKernelTest, GivenSpillFillWhenKernelIsInitializedThenConte TEST_P(PerformanceHintKernelTest, GivenPrivateSurfaceWhenKernelIsInitializedThenContextProvidesProperHint) { - auto pDevice = castToObject(devices[0]); + auto pDevice = castToObject(devices[0]); auto size = zeroSized ? 0 : 1024; MockKernelWithInternals mockKernel(*pDevice, context); SPatchAllocateStatelessPrivateSurface allocateStatelessPrivateMemorySurface; @@ -798,7 +798,7 @@ TEST(PerformanceHintsTransferTest, givenCommandTypeAndMemoryTransferRequiredWhen TEST_F(DriverDiagnosticsTest, givenInvalidCommandTypeWhenAskingForZeroCopyOperatonThenAbort) { cl_device_id deviceId = devices[0]; cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; - auto context = std::unique_ptr(Context::create(validProperties, DeviceVector(&deviceId, 1), + auto context = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, (void *)userData, retVal)); auto buffer = std::unique_ptr(Buffer::create(context.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal)); diff --git a/unit_tests/context/driver_diagnostics_tests.h b/unit_tests/context/driver_diagnostics_tests.h index 2b16a15e9a..6f2be22045 100644 --- a/unit_tests/context/driver_diagnostics_tests.h +++ b/unit_tests/context/driver_diagnostics_tests.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -77,7 +77,7 @@ struct PerformanceHintTest : public DriverDiagnosticsTest, DriverDiagnosticsTest::SetUp(); cl_device_id deviceID = devices[0]; cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; - context = Context::create(validProperties, DeviceVector(&deviceID, 1), callbackFunction, (void *)userData, retVal); + context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), callbackFunction, (void *)userData, retVal); EXPECT_EQ(CL_SUCCESS, retVal); } @@ -115,14 +115,16 @@ struct PerformanceHintCommandQueueTest : public PerformanceHintTest, std::tie(profilingEnabled, preemptionSupported) = GetParam(); device = new MockDevice; device->deviceInfo.preemptionSupported = preemptionSupported; + clDevice = new MockClDevice{device}; } void TearDown() override { clReleaseCommandQueue(cmdQ); - delete device; + delete clDevice; PerformanceHintTest::TearDown(); } MockDevice *device; + ClDevice *clDevice; cl_command_queue cmdQ; bool profilingEnabled; bool preemptionSupported; @@ -131,7 +133,7 @@ struct PerformanceHintCommandQueueTest : public PerformanceHintTest, struct PerformanceHintEnqueueTest : public PerformanceHintTest { void SetUp() override { PerformanceHintTest::SetUp(); - pCmdQ = createCommandQueue(pPlatform->getDevice(0)); + pCmdQ = createCommandQueue(pPlatform->getClDevice(0)); } void TearDown() override { @@ -227,7 +229,7 @@ struct PerformanceHintEnqueueKernelTest : public PerformanceHintEnqueueTest, void SetUp() override { PerformanceHintEnqueueTest::SetUp(); - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); CreateProgramFromBinary(context, &device, "CopyBuffer_simd32"); retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); ASSERT_EQ(CL_SUCCESS, retVal); @@ -263,7 +265,7 @@ struct PerformanceHintEnqueueKernelPrintfTest : public PerformanceHintEnqueueTes void SetUp() override { PerformanceHintEnqueueTest::SetUp(); - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); CreateProgramFromBinary(context, &device, "printf"); retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); ASSERT_EQ(CL_SUCCESS, retVal); diff --git a/unit_tests/context/get_supported_image_formats_tests.cpp b/unit_tests/context/get_supported_image_formats_tests.cpp index 47a8b4ab6e..5cd0f0a81b 100644 --- a/unit_tests/context/get_supported_image_formats_tests.cpp +++ b/unit_tests/context/get_supported_image_formats_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -48,7 +48,7 @@ TEST_P(GetSupportedImageFormatsTest, checkNumImageFormats) { uint32_t imageFormats; std::tie(imageFormatsFlags, imageFormats) = GetParam(); retVal = pContext->getSupportedImageFormats( - castToObject(devices[0]), + &castToObject(devices[0])->getDevice(), imageFormatsFlags, imageFormats, 0, @@ -65,7 +65,7 @@ TEST_P(GetSupportedImageFormatsTest, retrieveImageFormats) { uint32_t imageFormats; std::tie(imageFormatsFlags, imageFormats) = GetParam(); retVal = pContext->getSupportedImageFormats( - castToObject(devices[0]), + &castToObject(devices[0])->getDevice(), imageFormatsFlags, imageFormats, 0, @@ -77,7 +77,7 @@ TEST_P(GetSupportedImageFormatsTest, retrieveImageFormats) { memset(imageFormatList, 0, numImageFormats * sizeof(cl_image_format)); retVal = pContext->getSupportedImageFormats( - castToObject(devices[0]), + &castToObject(devices[0])->getDevice(), imageFormatsFlags, imageFormats, numImageFormats, @@ -102,7 +102,7 @@ TEST_P(GetSupportedImageFormatsTest, retrieveImageFormatsSRGB) { bool isReadOnly = false; std::tie(imageFormatsFlags, imageFormats) = GetParam(); retVal = pContext->getSupportedImageFormats( - castToObject(devices[0]), + &castToObject(devices[0])->getDevice(), imageFormatsFlags, imageFormats, 0, @@ -114,7 +114,7 @@ TEST_P(GetSupportedImageFormatsTest, retrieveImageFormatsSRGB) { memset(imageFormatList, 0, numImageFormats * sizeof(cl_image_format)); retVal = pContext->getSupportedImageFormats( - castToObject(devices[0]), + &castToObject(devices[0])->getDevice(), imageFormatsFlags, imageFormats, numImageFormats, @@ -159,13 +159,13 @@ TEST(ImageFormats, isDepthFormat) { struct PackedYuvExtensionSupportedImageFormatsTest : public ::testing::TestWithParam> { void SetUp() override { - device = std::unique_ptr(new MockDevice()); + device = std::make_unique(new MockDevice()); context = std::unique_ptr(new MockContext(device.get(), true)); } void TearDown() override { } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; cl_int retVal; }; @@ -185,7 +185,7 @@ TEST_P(PackedYuvExtensionSupportedImageFormatsTest, retrieveImageFormatsPackedYU device->deviceInfo.packedYuvExtension = true; retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, 0, @@ -197,7 +197,7 @@ TEST_P(PackedYuvExtensionSupportedImageFormatsTest, retrieveImageFormatsPackedYU memset(imageFormatList, 0, numImageFormats * sizeof(cl_image_format)); retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, numImageFormats, @@ -246,13 +246,13 @@ TEST_P(PackedYuvExtensionSupportedImageFormatsTest, retrieveImageFormatsPackedYU struct NV12ExtensionSupportedImageFormatsTest : public ::testing::TestWithParam> { void SetUp() override { - device = std::unique_ptr(new MockDevice()); + device = std::make_unique(new MockDevice()); context = std::unique_ptr(new MockContext(device.get(), true)); } void TearDown() override { } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; cl_int retVal; }; @@ -270,7 +270,7 @@ TEST_P(NV12ExtensionSupportedImageFormatsTest, givenNV12ExtensionWhenQueriedForI device->deviceInfo.packedYuvExtension = false; retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, 0, @@ -302,7 +302,7 @@ TEST_P(NV12ExtensionSupportedImageFormatsTest, givenNV12ExtensionWhenQueriedForI memset(imageFormatList, 0, numImageFormats * sizeof(cl_image_format)); retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, numImageFormats, @@ -338,7 +338,7 @@ TEST_P(NV12ExtensionUnsupportedImageFormatsTest, givenNV12ExtensionWhenQueriedFo device->deviceInfo.nv12Extension = true; retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, 0, @@ -367,7 +367,7 @@ TEST_P(NV12ExtensionUnsupportedImageFormatsTest, givenNV12ExtensionWhenQueriedFo memset(imageFormatList, 0, numImageFormats * sizeof(cl_image_format)); retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, numImageFormats, @@ -398,7 +398,7 @@ TEST_P(NV12ExtensionSupportedImageFormatsTest, retrieveLessImageFormatsThanAvail device->deviceInfo.nv12Extension = true; retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, 0, @@ -413,7 +413,7 @@ TEST_P(NV12ExtensionSupportedImageFormatsTest, retrieveLessImageFormatsThanAvail memset(imageFormatList, 0, numImageFormats * sizeof(cl_image_format)); retVal = context->getSupportedImageFormats( - device.get(), + &device->getDevice(), imageFormatsFlags, imageFormats, numImageFormats, diff --git a/unit_tests/context/gl/context_gl_tests.cpp b/unit_tests/context/gl/context_gl_tests.cpp index 22d221b8a5..58653c9455 100644 --- a/unit_tests/context/gl/context_gl_tests.cpp +++ b/unit_tests/context/gl/context_gl_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,7 +39,7 @@ struct ContextTest : public PlatformFixture, public ::testing::Test { properties[1] = (cl_context_properties)platform; properties[2] = 0; - context = Context::create(properties, DeviceVector(devices, num_devices), nullptr, nullptr, retVal); + context = Context::create(properties, ClDeviceVector(devices, num_devices), nullptr, nullptr, retVal); ASSERT_NE(nullptr, context); } @@ -64,28 +64,28 @@ TEST_F(ContextTest, GivenPropertiesWhenContextIsCreatedThenSuccess) { cl_context_properties validProperties[] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], CL_GL_CONTEXT_KHR, 0x10000, 0}; - auto context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + auto context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); delete context; validProperties[2] = CL_EGL_DISPLAY_KHR; - context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); delete context; validProperties[2] = CL_GLX_DISPLAY_KHR; - context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); delete context; validProperties[2] = CL_WGL_HDC_KHR; - context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); @@ -102,21 +102,21 @@ TEST_F(ContextTest, GivenTwoGlPropertiesWhenContextIsCreatedThenSuccess) { CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], CL_GL_CONTEXT_KHR, 0x10000, CL_GL_CONTEXT_KHR, 0x10000, 0}; validProperties[4] = CL_EGL_DISPLAY_KHR; - auto context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + auto context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); delete context; validProperties[4] = CL_GLX_DISPLAY_KHR; - context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); delete context; validProperties[4] = CL_WGL_HDC_KHR; - context = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + context = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, context); EXPECT_FALSE(context->getInteropUserSyncEnabled()); @@ -131,7 +131,7 @@ TEST_F(ContextTest, GivenGlContextParamWhenCreateContextThenInitSharingFunctions cl_context_properties validProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], CL_GL_CONTEXT_KHR, 0x10000, 0}; cl_int retVal = CL_SUCCESS; - auto ctx = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + auto ctx = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, ctx); diff --git a/unit_tests/d3d_sharing/cl_dx_sharing_tests.cpp b/unit_tests/d3d_sharing/cl_dx_sharing_tests.cpp index 5ab47c5ec2..e700c77190 100644 --- a/unit_tests/d3d_sharing/cl_dx_sharing_tests.cpp +++ b/unit_tests/d3d_sharing/cl_dx_sharing_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -153,7 +153,7 @@ struct clIntelSharingFormatQueryDX1X : public PlatformFixture, public ::testing: void SetUp() override { PlatformFixture::SetUp(); - context = new MockContext(pPlatform->getDevice(0)); + context = new MockContext(pPlatform->getClDevice(0)); mockSharingFcns = new NiceMock>(); context->setSharingFunctions(mockSharingFcns); diff --git a/unit_tests/d3d_sharing/d3d9_tests.cpp b/unit_tests/d3d_sharing/d3d9_tests.cpp index 68727ff86f..9f4f45713a 100644 --- a/unit_tests/d3d_sharing/d3d9_tests.cpp +++ b/unit_tests/d3d_sharing/d3d9_tests.cpp @@ -91,7 +91,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test { void SetUp() override { PlatformFixture::SetUp(); memoryManager = std::make_unique(*pPlatform->peekExecutionEnvironment()); - context = new MockContext(pPlatform->getDevice(0)); + context = new MockContext(pPlatform->getClDevice(0)); context->preferD3dSharedResources = true; context->memoryManager = memoryManager.get(); @@ -147,7 +147,7 @@ TEST_F(D3D9Tests, givenD3DDeviceParamWhenContextCreationThenSetProperValues) { for (int i = 0; i < 6; i++) { validProperties[2] = validAdapters[i]; - ctx.reset(Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); + ctx.reset(Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, ctx.get()); @@ -814,7 +814,7 @@ TEST_F(D3D9Tests, givenNullD3dDeviceWhenContextIsCreatedThenReturnErrorOnSurface cl_context_properties properties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)(cl_platform_id)pPlatform, CL_CONTEXT_ADAPTER_D3D9_KHR, 0, 0}; - std::unique_ptr ctx(Context::create(properties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); + std::unique_ptr ctx(Context::create(properties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(nullptr, ctx->getSharing>()->getDevice()); @@ -830,7 +830,7 @@ TEST_F(D3D9Tests, givenInvalidContextWhenSurfaceIsCreatedThenReturnError) { cl_context_properties properties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)(cl_platform_id)pPlatform, 0}; - std::unique_ptr ctx(Context::create(properties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); + std::unique_ptr ctx(Context::create(properties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(nullptr, ctx->getSharing>()); @@ -1134,4 +1134,4 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNotNullWhenCreatingSharedSurface ASSERT_NE(nullptr, sharedImg->getGraphicsAllocation()); EXPECT_EQ(expectedRootDeviceIndex, sharedImg->getGraphicsAllocation()->getRootDeviceIndex()); } -} // namespace NEO \ No newline at end of file +} // namespace NEO diff --git a/unit_tests/d3d_sharing/d3d_tests_part2.cpp b/unit_tests/d3d_sharing/d3d_tests_part2.cpp index 271eb7772b..feb82a1d0f 100644 --- a/unit_tests/d3d_sharing/d3d_tests_part2.cpp +++ b/unit_tests/d3d_sharing/d3d_tests_part2.cpp @@ -34,7 +34,7 @@ TYPED_TEST_P(D3DTests, givenSharedResourceBufferAndInteropUserSyncEnabledWhenRel class MockCmdQ : public CommandQueue { public: - MockCmdQ(Context *context, Device *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; + MockCmdQ(Context *context, ClDevice *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; cl_int finish() override { finishCalled++; return CL_SUCCESS; @@ -62,7 +62,7 @@ TYPED_TEST_P(D3DTests, givenNonSharedResourceBufferAndInteropUserSyncDisabledWhe class MockCmdQ : public CommandQueue { public: - MockCmdQ(Context *context, Device *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; + MockCmdQ(Context *context, ClDevice *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; cl_int finish() override { finishCalled++; return CL_SUCCESS; @@ -95,7 +95,7 @@ TYPED_TEST_P(D3DTests, givenSharedResourceBufferAndInteropUserSyncDisabledWhenRe class MockCmdQ : public CommandQueue { public: - MockCmdQ(Context *context, Device *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; + MockCmdQ(Context *context, ClDevice *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; cl_int finish() override { finishCalled++; return CL_SUCCESS; @@ -123,7 +123,7 @@ TYPED_TEST_P(D3DTests, givenNonSharedResourceBufferAndInteropUserSyncEnabledWhen class MockCmdQ : public CommandQueue { public: - MockCmdQ(Context *context, Device *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; + MockCmdQ(Context *context, ClDevice *device, const cl_queue_properties *properties) : CommandQueue(context, device, properties){}; cl_int finish() override { finishCalled++; return CL_SUCCESS; @@ -272,7 +272,7 @@ TYPED_TEST_P(D3DTests, givenD3DDeviceParamWhenContextCreationThenSetProperValues cl_context_properties validProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], param, 0, 0}; cl_int retVal = CL_SUCCESS; - auto ctx = std::unique_ptr(Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); + auto ctx = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, ctx.get()); diff --git a/unit_tests/device/device_tests.cpp b/unit_tests/device/device_tests.cpp index 19e2c72eb9..95ed912cfb 100644 --- a/unit_tests/device/device_tests.cpp +++ b/unit_tests/device/device_tests.cpp @@ -99,15 +99,25 @@ TEST_F(DeviceTest, GivenDebugVariableForcing32BitAllocationsWhenDeviceIsCreatedT } TEST_F(DeviceTest, retainAndRelease) { - ASSERT_NE(nullptr, pDevice); + ASSERT_NE(nullptr, pClDevice); - pDevice->retain(); - pDevice->retain(); - pDevice->retain(); - ASSERT_EQ(1, pDevice->getReference()); + pClDevice->retainApi(); + pClDevice->retainApi(); + pClDevice->retainApi(); + ASSERT_EQ(1, pClDevice->getReference()); - ASSERT_FALSE(pDevice->release().isUnused()); - ASSERT_EQ(1, pDevice->getReference()); + ASSERT_FALSE(pClDevice->releaseApi().isUnused()); + ASSERT_EQ(1, pClDevice->getReference()); +} + +TEST_F(DeviceTest, WhenAppendingOsExtensionsThenDeviceInfoIsProperlyUpdated) { + EXPECT_NE(nullptr, pDevice); + std::string testedValue = "1234!@#$"; + std::string expectedExtensions = pDevice->deviceExtensions + testedValue; + + pDevice->appendOSExtensions(testedValue); + EXPECT_EQ(expectedExtensions, pDevice->deviceExtensions); + EXPECT_STREQ(expectedExtensions.c_str(), pDevice->deviceInfo.deviceExtensions); } TEST_F(DeviceTest, getEngineTypeDefault) { diff --git a/unit_tests/device/get_device_info_size_tests.cpp b/unit_tests/device/get_device_info_size_tests.cpp index a61545e77a..6715fbb6c4 100644 --- a/unit_tests/device/get_device_info_size_tests.cpp +++ b/unit_tests/device/get_device_info_size_tests.cpp @@ -23,7 +23,7 @@ struct GetDeviceInfoSize : public ::testing::TestWithParam(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); size_t sizeReturned = 0; auto retVal = device->getDeviceInfo( @@ -129,7 +129,7 @@ INSTANTIATE_TEST_CASE_P( struct GetDeviceInfoForImage : public GetDeviceInfoSize {}; TEST_P(GetDeviceInfoForImage, imageInfoSizeIsValid) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(*MockDevice::createWithNewExecutionEnvironment(nullptr)); if (!device->getDeviceInfo().imageSupport) { GTEST_SKIP(); } @@ -147,7 +147,7 @@ TEST_P(GetDeviceInfoForImage, imageInfoSizeIsValid) { } TEST_P(GetDeviceInfoForImage, whenImageAreNotSupportedThenClInvalidValueIsReturned) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(*MockDevice::createWithNewExecutionEnvironment(nullptr)); if (device->getDeviceInfo().imageSupport) { GTEST_SKIP(); } @@ -161,7 +161,7 @@ TEST_P(GetDeviceInfoForImage, whenImageAreNotSupportedThenClInvalidValueIsReturn } TEST_P(GetDeviceInfoForImage, givenInfoImageParamsWhenCallGetDeviceInfoForImageThenSizeIsValidAndTrueReturned) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(*MockDevice::createWithNewExecutionEnvironment(nullptr)); size_t srcSize = 0; size_t retSize = 0; const void *src = nullptr; @@ -177,7 +177,7 @@ TEST_P(GetDeviceInfoForImage, givenInfoImageParamsWhenCallGetDeviceInfoForImageT } TEST(GetDeviceInfoForImage, givenNotImageParamWhenCallGetDeviceInfoForImageThenSizeIsNotValidAndFalseReturned) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(*MockDevice::createWithNewExecutionEnvironment(nullptr)); size_t srcSize = 0; size_t retSize = 0; const void *src = nullptr; @@ -214,7 +214,7 @@ INSTANTIATE_TEST_CASE_P( testing::ValuesIn(deviceInfoImageParams)); TEST(DeviceInfoTests, givenDefaultDeviceWhenQueriedForDeviceVersionThenProperSizeIsReturned) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); size_t sizeReturned = 0; auto retVal = device->getDeviceInfo( CL_DEVICE_VERSION, diff --git a/unit_tests/device/get_device_info_tests.cpp b/unit_tests/device/get_device_info_tests.cpp index 880c42ccf7..6804f854f3 100644 --- a/unit_tests/device/get_device_info_tests.cpp +++ b/unit_tests/device/get_device_info_tests.cpp @@ -17,7 +17,7 @@ using namespace NEO; TEST(GetDeviceInfo, InvalidFlags_returnsError) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto retVal = device->getDeviceInfo( 0, @@ -43,7 +43,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, GetDeviceInfoMemCapabilitiesTest, GivenValidParamete } TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtensionDisabledAndSupportImageEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; device->deviceInfo.nv12Extension = false; uint32_t value; @@ -66,7 +66,7 @@ TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtens } TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsCorrectValuesWhenPlanarYuvExtensionEnabledAndSupportImageEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; device->deviceInfo.nv12Extension = true; size_t value = 0; @@ -91,7 +91,7 @@ TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsCorrectValuesWhenPlanarY } TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtensionDisabledAndSupportImageDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; device->deviceInfo.nv12Extension = false; uint32_t value; @@ -114,7 +114,7 @@ TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtens } TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtensionEnabledAndSupportImageDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; device->deviceInfo.nv12Extension = true; size_t value = 0; @@ -137,7 +137,7 @@ TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtens } TEST(GetDeviceInfo, clDeviceImage2dMaxWidthHeightReturnsErrorWhenImageSupportDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; uint32_t value; @@ -160,7 +160,7 @@ TEST(GetDeviceInfo, clDeviceImage2dMaxWidthHeightReturnsErrorWhenImageSupportDis } TEST(GetDeviceInfo, clDeviceImage2dMaxWidthHeightReturnsCorrectValuesWhenImageSupportEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; size_t value = 0; @@ -183,7 +183,7 @@ TEST(GetDeviceInfo, clDeviceImage2dMaxWidthHeightReturnsCorrectValuesWhenImageSu } TEST(GetDeviceInfo, clDeviceImage3dMaxWidthHeightDepthReturnsErrorWhenImageSupportDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; uint32_t value; @@ -214,7 +214,7 @@ TEST(GetDeviceInfo, clDeviceImage3dMaxWidthHeightDepthReturnsErrorWhenImageSuppo } TEST(GetDeviceInfo, clDeviceImage3dMaxWidthHeightDepthReturnsCorrectValuesWhenImageSupportEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; size_t value = 0; @@ -245,7 +245,7 @@ TEST(GetDeviceInfo, clDeviceImage3dMaxWidthHeightDepthReturnsCorrectValuesWhenIm } TEST(GetDeviceInfo, clDeviceImageMaxArgsReturnsErrorWhenImageSupportDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; uint32_t value; @@ -276,7 +276,7 @@ TEST(GetDeviceInfo, clDeviceImageMaxArgsReturnsErrorWhenImageSupportDisabled) { } TEST(GetDeviceInfo, clDeviceImageMaxArgsReturnsCorrectValuesWhenImageSupportEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; size_t value = 0; @@ -307,7 +307,7 @@ TEST(GetDeviceInfo, clDeviceImageMaxArgsReturnsCorrectValuesWhenImageSupportEnab } TEST(GetDeviceInfo, clDeviceImageBaseAddressAlignmentReturnsErrorWhenImageSupportDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; uint32_t value; @@ -322,7 +322,7 @@ TEST(GetDeviceInfo, clDeviceImageBaseAddressAlignmentReturnsErrorWhenImageSuppor } TEST(GetDeviceInfo, clDeviceImageBaseAddressAlignmentReturnsCorrectValuesWhenImageSupportEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; size_t value = 0; @@ -337,7 +337,7 @@ TEST(GetDeviceInfo, clDeviceImageBaseAddressAlignmentReturnsCorrectValuesWhenIma } TEST(GetDeviceInfo, clDeviceImageMaxArraySizeReturnsErrorWhenImageSupportDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; uint32_t value; @@ -352,7 +352,7 @@ TEST(GetDeviceInfo, clDeviceImageMaxArraySizeReturnsErrorWhenImageSupportDisable } TEST(GetDeviceInfo, clDeviceImageMaxArraySizeReturnsCorrectValuesWhenImageSupportEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; size_t value = 0; @@ -367,7 +367,7 @@ TEST(GetDeviceInfo, clDeviceImageMaxArraySizeReturnsCorrectValuesWhenImageSuppor } TEST(GetDeviceInfo, clDeviceImageMaxBufferSizeReturnsErrorWhenImageSupportDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; uint32_t value; @@ -382,7 +382,7 @@ TEST(GetDeviceInfo, clDeviceImageMaxBufferSizeReturnsErrorWhenImageSupportDisabl } TEST(GetDeviceInfo, clDeviceImageMaxBufferSizeReturnsCorrectValuesWhenImageSupportEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; size_t value = 0; @@ -397,7 +397,7 @@ TEST(GetDeviceInfo, clDeviceImageMaxBufferSizeReturnsCorrectValuesWhenImageSuppo } TEST(GetDeviceInfo, clDeviceImagePtichAlignmentReturnsErrorWhenImageSupportDisabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = false; uint32_t value; @@ -412,7 +412,7 @@ TEST(GetDeviceInfo, clDeviceImagePtichAlignmentReturnsErrorWhenImageSupportDisab } TEST(GetDeviceInfo, clDeviceImagePtichAlignmentReturnsCorrectValuesWhenImageSupportEnabled) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->deviceInfo.imageSupport = true; size_t value = 0; @@ -427,7 +427,7 @@ TEST(GetDeviceInfo, clDeviceImagePtichAlignmentReturnsCorrectValuesWhenImageSupp } TEST(GetDeviceInfo, numSimultaneousInterops) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->simultaneousInterops = {0}; cl_uint value = 0; @@ -446,7 +446,7 @@ TEST(GetDeviceInfo, numSimultaneousInterops) { } TEST(GetDeviceInfo, simultaneousInterops) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); device->simultaneousInterops = {0}; cl_uint value[4] = {}; @@ -463,7 +463,7 @@ TEST(GetDeviceInfo, simultaneousInterops) { } TEST(GetDeviceInfo, preferredInteropUserSync) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); cl_bool value = 0; size_t size = 0; @@ -483,7 +483,7 @@ struct GetDeviceInfo : public ::testing::TestWithParam(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); size_t sizeReturned = 0; auto retVal = device->getDeviceInfo( diff --git a/unit_tests/device/sub_device_tests.cpp b/unit_tests/device/sub_device_tests.cpp index e0325a84c7..7e34feee08 100644 --- a/unit_tests/device/sub_device_tests.cpp +++ b/unit_tests/device/sub_device_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -55,28 +55,26 @@ TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenSubDeviceRefcountsAreChangedTh DebugManagerStateRestore restorer; DebugManager.flags.CreateMultipleSubDevices.set(2); VariableBackup mockDeviceFlagBackup(&MockDevice::createSingleDevice, false); - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + constructPlatform()->initialize(); + auto device = platform()->getClDevice(0); - auto subDevice0 = device->subdevices.at(0).get(); - auto subDevice1 = device->subdevices.at(1).get(); - auto baseApiRefCount = device->getRefApiCount(); - auto baseInternalRefCount = device->getRefInternalCount(); + auto subDevice = device->getDeviceById(1); + auto baseDeviceApiRefCount = device->getRefApiCount(); + auto baseDeviceInternalRefCount = device->getRefInternalCount(); + auto baseSubDeviceApiRefCount = subDevice->getRefApiCount(); + auto baseSubDeviceInternalRefCount = subDevice->getRefInternalCount(); - subDevice0->retain(); - EXPECT_EQ(baseInternalRefCount + 1, device->getRefInternalCount()); - EXPECT_EQ(baseApiRefCount, device->getRefApiCount()); + subDevice->retainApi(); + EXPECT_EQ(baseDeviceApiRefCount, device->getRefApiCount()); + EXPECT_EQ(baseDeviceInternalRefCount + 1, device->getRefInternalCount()); + EXPECT_EQ(baseSubDeviceApiRefCount + 1, subDevice->getRefApiCount()); + EXPECT_EQ(baseSubDeviceInternalRefCount + 1, subDevice->getRefInternalCount()); - subDevice1->retainInternal(); - EXPECT_EQ(baseInternalRefCount + 2, device->getRefInternalCount()); - EXPECT_EQ(baseApiRefCount, device->getRefApiCount()); - - subDevice0->release(); - EXPECT_EQ(baseInternalRefCount + 1, device->getRefInternalCount()); - EXPECT_EQ(baseApiRefCount, device->getRefApiCount()); - - subDevice1->releaseInternal(); - EXPECT_EQ(baseInternalRefCount, device->getRefInternalCount()); - EXPECT_EQ(baseApiRefCount, device->getRefApiCount()); + subDevice->releaseApi(); + EXPECT_EQ(baseDeviceApiRefCount, device->getRefApiCount()); + EXPECT_EQ(baseDeviceInternalRefCount, device->getRefInternalCount()); + EXPECT_EQ(baseSubDeviceApiRefCount, subDevice->getRefApiCount()); + EXPECT_EQ(baseSubDeviceInternalRefCount, subDevice->getRefInternalCount()); } TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenSubDeviceCreationFailThenWholeDeviceIsDestroyed) { @@ -119,8 +117,8 @@ TEST(SubDevicesTest, givenSubDeviceWhenOsContextIsCreatedThenItsBitfieldBasesOnS EXPECT_EQ(2u, device->getNumSubDevices()); - auto firstSubDevice = static_cast(device->subdevices.at(0).get()); - auto secondSubDevice = static_cast(device->subdevices.at(1).get()); + auto firstSubDevice = static_cast(device->subdevices.at(0)); + auto secondSubDevice = static_cast(device->subdevices.at(1)); uint32_t firstSubDeviceMask = (1u << 0); uint32_t secondSubDeviceMask = (1u << 1); EXPECT_EQ(firstSubDeviceMask, static_cast(firstSubDevice->getDefaultEngine().osContext->getDeviceBitfield().to_ulong())); @@ -141,8 +139,8 @@ TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenGettingDeviceByIdThenGetCorrec VariableBackup mockDeviceFlagBackup(&MockDevice::createSingleDevice, false); auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); EXPECT_EQ(2u, device->getNumSubDevices()); - EXPECT_EQ(device->subdevices.at(0).get(), device->getDeviceById(0)); - EXPECT_EQ(device->subdevices.at(1).get(), device->getDeviceById(1)); + EXPECT_EQ(device->subdevices.at(0), device->getDeviceById(0)); + EXPECT_EQ(device->subdevices.at(1), device->getDeviceById(1)); EXPECT_THROW(device->getDeviceById(2), std::exception); } @@ -152,7 +150,7 @@ TEST(SubDevicesTest, givenSubDevicesWhenGettingDeviceByIdZeroThenGetThisSubDevic VariableBackup mockDeviceFlagBackup(&MockDevice::createSingleDevice, false); auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); EXPECT_EQ(2u, device->getNumSubDevices()); - auto subDevice = device->subdevices.at(0).get(); + auto subDevice = device->subdevices.at(0); EXPECT_EQ(subDevice, subDevice->getDeviceById(0)); EXPECT_THROW(subDevice->getDeviceById(1), std::exception); diff --git a/unit_tests/device_queue/device_queue_hw_tests.cpp b/unit_tests/device_queue/device_queue_hw_tests.cpp index 6f50726b7e..45d7bb2319 100644 --- a/unit_tests/device_queue/device_queue_hw_tests.cpp +++ b/unit_tests/device_queue/device_queue_hw_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -489,11 +489,12 @@ class DeviceQueueHwWithKernel : public ExecutionModelKernelFixture { 0, 0, 0}; cl_int errcodeRet = 0; - device = MockDevice::createWithNewExecutionEnvironment(platformDevices[0]); + clDevice = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(platformDevices[0])}; + device = &clDevice->getDevice(); context = new MockContext(); ASSERT_NE(nullptr, context); - devQueue = DeviceQueue::create(context, device, + devQueue = DeviceQueue::create(context, clDevice, *properties, errcodeRet); @@ -502,11 +503,12 @@ class DeviceQueueHwWithKernel : public ExecutionModelKernelFixture { void TearDown() override { delete devQueue; delete context; - delete device; + delete clDevice; ExecutionModelKernelFixture::TearDown(); } Device *device; + ClDevice *clDevice; DeviceQueue *devQueue; MockContext *context; }; @@ -578,7 +580,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, DeviceQueueHwWithKernel, setupIndirectStateSetsCorre pKernel->createReflectionSurface(); MockContext mockContext; - MockDeviceQueueHw *devQueueHw = new MockDeviceQueueHw(&mockContext, device, deviceQueueProperties::minimumProperties[0]); + MockDeviceQueueHw *devQueueHw = new MockDeviceQueueHw(&mockContext, clDevice, deviceQueueProperties::minimumProperties[0]); ASSERT_NE(nullptr, devQueueHw); auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); ASSERT_NE(nullptr, dsh); @@ -611,7 +613,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, DeviceQueueHwWithKernel, GivenHasBarriersSetWhenCall pKernel->createReflectionSurface(); MockContext mockContext; - auto devQueueHw = std::make_unique>(&mockContext, device, deviceQueueProperties::minimumProperties[0]); + auto devQueueHw = std::make_unique>(&mockContext, clDevice, deviceQueueProperties::minimumProperties[0]); auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); uint32_t parentCount = 1; @@ -655,7 +657,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, resetDeviceQueueSetEa DebugManager.flags.SchedulerSimulationReturnInstance.set(3); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockContext context; std::unique_ptr> mockDeviceQueueHw(new MockDeviceQueueHw(&context, device.get(), deviceQueueProperties::minimumProperties[0])); @@ -669,7 +671,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, addMediaStateClearCmd using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using MEDIA_VFE_STATE = typename FamilyType::MEDIA_VFE_STATE; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockContext context; std::unique_ptr> mockDeviceQueueHw(new MockDeviceQueueHw(&context, device.get(), deviceQueueProperties::minimumProperties[0])); @@ -704,7 +706,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, addExecutionModelClea class MockDeviceQueueWithMediaStateClearRegistering : public MockDeviceQueueHw { public: MockDeviceQueueWithMediaStateClearRegistering(Context *context, - Device *device, + ClDevice *device, cl_queue_properties &properties) : MockDeviceQueueHw(context, device, properties) { } @@ -713,7 +715,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, addExecutionModelClea addMediaStateClearCmdsCalled = true; } }; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockContext context(device.get()); std::unique_ptr mockDeviceQueueHw(new MockDeviceQueueWithMediaStateClearRegistering(&context, device.get(), deviceQueueProperties::minimumProperties[0])); @@ -730,7 +732,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, getMediaStateClearCmd using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using MEDIA_VFE_STATE = typename FamilyType::MEDIA_VFE_STATE; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockContext context; std::unique_ptr> mockDeviceQueueHw(new MockDeviceQueueHw(&context, device.get(), deviceQueueProperties::minimumProperties[0])); @@ -746,7 +748,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, getExecutionModelClea using MI_MATH = typename FamilyType::MI_MATH; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockContext context; std::unique_ptr> mockDeviceQueueHw(new MockDeviceQueueHw(&context, device.get(), deviceQueueProperties::minimumProperties[0])); @@ -771,7 +773,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, getProfilingEndCmdsSi using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM; using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockContext context; std::unique_ptr> mockDeviceQueueHw(new MockDeviceQueueHw(&context, device.get(), deviceQueueProperties::minimumProperties[0])); diff --git a/unit_tests/device_queue/device_queue_tests.cpp b/unit_tests/device_queue/device_queue_tests.cpp index 368cf4eddb..e3d4882125 100644 --- a/unit_tests/device_queue/device_queue_tests.cpp +++ b/unit_tests/device_queue/device_queue_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -67,7 +67,7 @@ class DeviceQueueTest : public DeviceHostQueueFixture { } DeviceQueue *deviceQueue; - Device *device; + ClDevice *device; }; HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, createDeviceQueueWhenNoDeviceQueueIsSupported) { diff --git a/unit_tests/event/event_builder_tests.cpp b/unit_tests/event/event_builder_tests.cpp index 3aa407f185..5a81adc5a9 100644 --- a/unit_tests/event/event_builder_tests.cpp +++ b/unit_tests/event/event_builder_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -76,7 +76,7 @@ TEST(EventBuilder, givenVirtualEventWithCommandThenFinalizeAddChild) { : CommandComputeKernel(commandQueue, kernelOperation, surfaces, false, false, false, nullptr, PreemptionMode::Disabled, kernel, 0) {} }; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); CommandQueue cmdQ(nullptr, device.get(), nullptr); MockKernelWithInternals kernel(*device); @@ -125,7 +125,7 @@ TEST(EventBuilder, givenVirtualEventWithSubmittedCommandAsParentThenFinalizeNotA : CommandComputeKernel(commandQueue, kernelOperation, surfaces, false, false, false, nullptr, PreemptionMode::Disabled, kernel, 0) {} }; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); CommandQueue cmdQ(nullptr, device.get(), nullptr); MockKernelWithInternals kernel(*device); @@ -332,7 +332,7 @@ TEST(EventBuilder, whenAddingMultipleEventsAsNewParentsThenOnlyValidOnesAreInser } TEST(EventBuilder, parentListDoesNotHaveDuplicates) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext mockContext; MockCommandQueue mockCommandQueue(&mockContext, mockDevice.get(), nullptr); diff --git a/unit_tests/event/event_callbacks_tests.cpp b/unit_tests/event/event_callbacks_tests.cpp index a1daba2b0e..0a1ceac5d7 100644 --- a/unit_tests/event/event_callbacks_tests.cpp +++ b/unit_tests/event/event_callbacks_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -40,7 +40,7 @@ TEST(EventCallbackTest, NestedCallbacksAreCalledForUserEvent) { } TEST(EventCallbackTest, NestedCallbacksAreCalledForEvent) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext context; MockCommandQueue queue(&context, device.get(), nullptr); MockEvent event(&queue, CL_COMMAND_MARKER, 0, 0); diff --git a/unit_tests/event/event_fixture.h b/unit_tests/event/event_fixture.h index d828b80142..5a866b7d6c 100644 --- a/unit_tests/event/event_fixture.h +++ b/unit_tests/event/event_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ struct EventTest void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(&mockContext, pDevice, 0); + CommandQueueFixture::SetUp(&mockContext, pClDevice, 0); CommandStreamFixture::SetUp(pCmdQ); } @@ -54,7 +54,7 @@ struct InternalsEventTest void SetUp() { DeviceFixture::SetUp(); - mockContext = new MockContext(pDevice); + mockContext = new MockContext(pClDevice); } void TearDown() { diff --git a/unit_tests/event/event_tests.cpp b/unit_tests/event/event_tests.cpp index f050afb2e2..661033d27e 100644 --- a/unit_tests/event/event_tests.cpp +++ b/unit_tests/event/event_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -44,7 +44,7 @@ TEST(Event, NonAssignable) { } TEST(Event, dontUpdateExecutionStatusOnNotReadyEvent) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext ctx; MockCommandQueue cmdQ(&ctx, mockDevice.get(), 0); Event event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, Event::eventNotReady, 0); @@ -56,7 +56,7 @@ TEST(Event, dontUpdateExecutionStatusOnNotReadyEvent) { } TEST(Event, givenEventThatStatusChangeWhenPeekIsCalledThenEventIsNotUpdated) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext ctx; MockCommandQueue cmdQ(&ctx, mockDevice.get(), 0); @@ -108,7 +108,7 @@ TEST(Event_, testGetTaskCount) { } TEST(Event_, testGetEventInfoReturnsTheCQ) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto ctx = std::unique_ptr(new MockContext()); auto cmdQ = std::unique_ptr(new MockCommandQueue(ctx.get(), mockDevice.get(), 0)); Event *event = new Event(cmdQ.get(), CL_COMMAND_NDRANGE_KERNEL, 1, 5); @@ -128,7 +128,7 @@ TEST(Event_, testGetEventInfoReturnsTheCQ) { } TEST(Event, givenCommandQueueWhenEventIsCreatedWithCommandQueueThenCommandQueueInternalRefCountIsIncremented) { - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext ctx; MockCommandQueue cmdQ(&ctx, mockDevice.get(), 0); auto intitialRefCount = cmdQ.getRefInternalCount(); @@ -163,7 +163,7 @@ TEST(Event, waitForEventsFlushesAllQueues) { public: MockCommandQueueWithFlushCheck() = delete; MockCommandQueueWithFlushCheck(MockCommandQueueWithFlushCheck &) = delete; - MockCommandQueueWithFlushCheck(Context &context, Device *device) : MockCommandQueue(&context, device, nullptr) { + MockCommandQueueWithFlushCheck(Context &context, ClDevice *device) : MockCommandQueue(&context, device, nullptr) { } cl_int flush() override { flushCounter++; @@ -172,7 +172,7 @@ TEST(Event, waitForEventsFlushesAllQueues) { uint32_t flushCounter = 0; }; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext context; std::unique_ptr cmdQ1(new MockCommandQueueWithFlushCheck(context, device.get())); @@ -194,7 +194,7 @@ TEST(Event, waitForEventsWithNotReadyEventDoesNotFlushQueue) { public: MockCommandQueueWithFlushCheck() = delete; MockCommandQueueWithFlushCheck(MockCommandQueueWithFlushCheck &) = delete; - MockCommandQueueWithFlushCheck(Context &context, Device *device) : MockCommandQueue(&context, device, nullptr) { + MockCommandQueueWithFlushCheck(Context &context, ClDevice *device) : MockCommandQueue(&context, device, nullptr) { } cl_int flush() override { flushCounter++; @@ -203,7 +203,7 @@ TEST(Event, waitForEventsWithNotReadyEventDoesNotFlushQueue) { uint32_t flushCounter = 0; }; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext context; std::unique_ptr cmdQ1(new MockCommandQueueWithFlushCheck(context, device.get())); @@ -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(executionEnvironment, 0u)); + device.reset(new ClDevice{*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)); @@ -405,7 +405,7 @@ struct UpdateEventTest : public ::testing::Test { ExecutionEnvironment *executionEnvironment; MockMemoryManager *memoryManager; MockHostPtrManager *hostPtrManager; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr commandQueue; }; @@ -457,7 +457,7 @@ class SurfaceMock : public Surface { }; TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) { - CommandQueue cmdQ(mockContext, pDevice, nullptr); + CommandQueue cmdQ(mockContext, pClDevice, nullptr); MockEvent event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER})); @@ -469,7 +469,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) { auto blockedCommandsData = std::make_unique(cmdStream, *cmdQ.getGpgpuCommandStreamReceiver().getInternalAllocationStorage()); blockedCommandsData->setHeaps(dsh, ioh, ssh); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto pKernel = mockKernelWithInternals.mockKernel; auto &csr = cmdQ.getGpgpuCommandStreamReceiver(); @@ -509,7 +509,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) { } TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) { - CommandQueue cmdQ(mockContext, pDevice, nullptr); + CommandQueue cmdQ(mockContext, pClDevice, nullptr); MockEvent event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER})); @@ -521,7 +521,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) { auto blockedCommandsData = std::make_unique(cmdStream, *cmdQ.getGpgpuCommandStreamReceiver().getInternalAllocationStorage()); blockedCommandsData->setHeaps(dsh, ioh, ssh); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto pKernel = mockKernelWithInternals.mockKernel; auto &csr = cmdQ.getGpgpuCommandStreamReceiver(); @@ -543,7 +543,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) { TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOutput) { testing::internal::CaptureStdout(); - CommandQueue cmdQ(mockContext, pDevice, nullptr); + CommandQueue cmdQ(mockContext, pClDevice, nullptr); MockEvent event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER})); @@ -561,7 +561,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut std::string testString = "test"; - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto pKernel = mockKernelWithInternals.mockKernel; KernelInfo *kernelInfo = const_cast(&pKernel->getKernelInfo()); kernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface; @@ -570,7 +570,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut pKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8); MockMultiDispatchInfo multiDispatchInfo(pKernel); - std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *pDevice)); + std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *pClDevice)); printfHandler.get()->prepareDispatch(multiDispatchInfo); auto surface = printfHandler.get()->getSurface(); @@ -595,7 +595,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut } TEST_F(InternalsEventTest, processBlockedCommandsMapOperation) { - auto pCmdQ = make_releaseable(mockContext, pDevice, nullptr); + auto pCmdQ = make_releaseable(mockContext, pClDevice, nullptr); MockEvent event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto &csr = pCmdQ->getGpgpuCommandStreamReceiver(); @@ -616,7 +616,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsMapOperation) { } TEST_F(InternalsEventTest, processBlockedCommandsMapOperationNonZeroCopyBuffer) { - auto pCmdQ = make_releaseable(mockContext, pDevice, nullptr); + auto pCmdQ = make_releaseable(mockContext, pClDevice, nullptr); MockEvent event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto &csr = pCmdQ->getGpgpuCommandStreamReceiver(); @@ -681,7 +681,7 @@ class InternalsEventProfilingTest : public InternalsEventTest, TEST_P(InternalsEventProfilingTest, GivenProfilingWhenEventCreatedThenProfilingSet) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - std::unique_ptr pCmdQ(new CommandQueue(mockContext, pDevice, props)); + std::unique_ptr pCmdQ(new CommandQueue(mockContext, pClDevice, props)); std::unique_ptr> event(new MockEvent(pCmdQ.get(), GetParam(), 0, 0)); EXPECT_TRUE(event.get()->isProfilingEnabled()); @@ -693,7 +693,7 @@ INSTANTIATE_TEST_CASE_P(InternalsEventProfilingTest, TEST_F(InternalsEventTest, GivenProfilingWhenUserEventCreatedThenProfilingNotSet) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - std::unique_ptr pCmdQ(new CommandQueue(mockContext, pDevice, props)); + std::unique_ptr pCmdQ(new CommandQueue(mockContext, pClDevice, props)); std::unique_ptr> event(new MockEvent(pCmdQ.get(), CL_COMMAND_USER, 0, 0)); EXPECT_FALSE(event.get()->isProfilingEnabled()); @@ -701,7 +701,7 @@ TEST_F(InternalsEventTest, GivenProfilingWhenUserEventCreatedThenProfilingNotSet TEST_F(InternalsEventTest, GIVENProfilingWHENMapOperationTHENTimesSet) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); + CommandQueue *pCmdQ = new CommandQueue(mockContext, pClDevice, props); MockEvent *event = new MockEvent(pCmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0); @@ -728,7 +728,7 @@ TEST_F(InternalsEventTest, GIVENProfilingWHENMapOperationTHENTimesSet) { TEST_F(InternalsEventTest, processBlockedCommandsUnMapOperation) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - auto pCmdQ = make_releaseable(mockContext, pDevice, props); + auto pCmdQ = make_releaseable(mockContext, pClDevice, props); MockEvent event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto &csr = pCmdQ->getGpgpuCommandStreamReceiver(); @@ -750,7 +750,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsUnMapOperation) { TEST_F(InternalsEventTest, givenBlockedMapCommandWhenSubmitIsCalledItReleasesMemObjectReference) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - auto pCmdQ = std::make_unique(mockContext, pDevice, props); + auto pCmdQ = std::make_unique(mockContext, pClDevice, props); MockEvent event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto buffer = new UnalignedBuffer; @@ -769,7 +769,7 @@ TEST_F(InternalsEventTest, givenBlockedMapCommandWhenSubmitIsCalledItReleasesMem } TEST_F(InternalsEventTest, processBlockedCommandsUnMapOperationNonZeroCopyBuffer) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - auto pCmdQ = std::make_unique(mockContext, pDevice, props); + auto pCmdQ = std::make_unique(mockContext, pClDevice, props); MockEvent event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0); auto &csr = pCmdQ->getGpgpuCommandStreamReceiver(); @@ -791,7 +791,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsUnMapOperationNonZeroCopyBuffer HWTEST_F(InternalsEventTest, givenCpuProfilingPathWhenEnqueuedMarkerThenDontUseTimeStampNode) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); + CommandQueue *pCmdQ = new CommandQueue(mockContext, pClDevice, props); MockEvent *event = new MockEvent(pCmdQ, CL_COMMAND_MARKER, 0, 0); event->setCPUProfilingPath(true); @@ -829,7 +829,7 @@ struct InternalsEventWithPerfCountersTest }; HWTEST_F(InternalsEventWithPerfCountersTest, givenCpuProfilingPerfCountersPathWhenEnqueuedMarkerThenDontUseTimeStampNodePerfCounterNode) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); + CommandQueue *pCmdQ = new CommandQueue(mockContext, pClDevice, props); bool ret = false; ret = pCmdQ->setPerfCountersEnabled(); EXPECT_TRUE(ret); @@ -855,7 +855,7 @@ HWTEST_F(InternalsEventWithPerfCountersTest, givenCpuProfilingPerfCountersPathWh HWTEST_F(InternalsEventWithPerfCountersTest, givenCpuProfilingPerfCountersPathWhenEnqueuedMarkerThenUseTimeStampNodePerfCounterNode) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); + CommandQueue *pCmdQ = new CommandQueue(mockContext, pClDevice, props); pCmdQ->setPerfCountersEnabled(); MockEvent *event = new MockEvent(pCmdQ, CL_COMMAND_MARKER, 0, 0); event->setCPUProfilingPath(true); @@ -882,7 +882,7 @@ HWTEST_F(InternalsEventWithPerfCountersTest, givenCpuProfilingPerfCountersPathWh TEST_F(InternalsEventWithPerfCountersTest, IsPerfCounter_Enabled) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); + CommandQueue *pCmdQ = new CommandQueue(mockContext, pClDevice, props); pCmdQ->setPerfCountersEnabled(); Event *ev = new Event(pCmdQ, CL_COMMAND_COPY_BUFFER, 3, 0); EXPECT_TRUE(ev->isProfilingEnabled()); @@ -912,7 +912,7 @@ HWTEST_F(EventTest, givenVirtualEventWhenCommandSubmittedThenLockCSROccurs) { taskLevel, taskCount) {} }; - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); IndirectHeap *ih1 = nullptr, *ih2 = nullptr, *ih3 = nullptr; pCmdQ->allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1); @@ -977,7 +977,7 @@ HWTEST_F(InternalsEventTest, GivenBufferWithoutZeroCopyOnCommandMapOrUnmapFlushe pDevice->resetCommandStreamReceiver(csr); const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; - auto pCmdQ = make_releaseable(mockContext, pDevice, props); + auto pCmdQ = make_releaseable(mockContext, pClDevice, props); MockNonZeroCopyBuff buffer(executionStamp); @@ -1168,7 +1168,7 @@ TEST_F(EventTest, IsPerfCounter_DisabledByNoProfiling) { TEST_F(InternalsEventTest, IsPerfCounter_DisabledByNoPerfCounter) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); + CommandQueue *pCmdQ = new CommandQueue(mockContext, pClDevice, props); Event *ev = new Event(pCmdQ, CL_COMMAND_COPY_BUFFER, 3, 0); EXPECT_TRUE(ev->isProfilingEnabled()); @@ -1244,7 +1244,7 @@ TEST_F(EventTest, givenOutEventWhenBlockingEnqueueHandledOnCpuThenUpdateTaskCoun TEST_F(EventTest, givenCmdQueueWithProfilingWhenIsCpuProfilingIsCalledThenTrueIsReturned) { const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; - std::unique_ptr pCmdQ(new CommandQueue(&mockContext, pDevice, props)); + std::unique_ptr pCmdQ(new CommandQueue(&mockContext, pClDevice, props)); MockEvent ev(pCmdQ.get(), CL_COMMAND_MAP_IMAGE, Event::eventNotReady, Event::eventNotReady); bool cpuProfiling = ev.isCPUProfilingPath() != 0; @@ -1432,7 +1432,7 @@ HWTEST_F(EventTest, givenNonQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestT } HWTEST_F(InternalsEventTest, givenCommandWhenSubmitCalledThenUpdateFlushStamp) { - auto pCmdQ = std::unique_ptr(new CommandQueue(mockContext, pDevice, 0)); + auto pCmdQ = std::unique_ptr(new CommandQueue(mockContext, pClDevice, 0)); MockEvent *event = new MockEvent(pCmdQ.get(), CL_COMMAND_MARKER, 0, 0); auto &csr = pDevice->getUltCommandStreamReceiver(); csr.flushStamp->setStamp(5); @@ -1446,12 +1446,12 @@ HWTEST_F(InternalsEventTest, givenCommandWhenSubmitCalledThenUpdateFlushStamp) { } HWTEST_F(InternalsEventTest, givenAbortedCommandWhenSubmitCalledThenDontUpdateFlushStamp) { - auto pCmdQ = std::unique_ptr(new CommandQueue(mockContext, pDevice, 0)); + auto pCmdQ = std::unique_ptr(new CommandQueue(mockContext, pClDevice, 0)); MockEvent *event = new MockEvent(pCmdQ.get(), CL_COMMAND_MARKER, 0, 0); auto &csr = pDevice->getUltCommandStreamReceiver(); csr.flushStamp->setStamp(5); - MockKernelWithInternals mockKernelWithInternals(*pDevice); + MockKernelWithInternals mockKernelWithInternals(*pClDevice); auto pKernel = mockKernelWithInternals.mockKernel; auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER})); diff --git a/unit_tests/execution_environment/execution_environment_tests.cpp b/unit_tests/execution_environment/execution_environment_tests.cpp index 3cd2b52ac7..b69f1c655d 100644 --- a/unit_tests/execution_environment/execution_environment_tests.cpp +++ b/unit_tests/execution_environment/execution_environment_tests.cpp @@ -70,7 +70,7 @@ TEST(ExecutionEnvironment, givenDeviceThatHaveRefferencesAfterPlatformIsDestroye std::unique_ptr platform(new Platform); auto executionEnvironment = platform->peekExecutionEnvironment(); platform->initialize(); - auto device = platform->getDevice(0); + auto device = platform->getClDevice(0); EXPECT_EQ(1, device->getRefInternalCount()); device->incRefInternal(); platform.reset(nullptr); diff --git a/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp b/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp index 69850a56ef..cfe74e6de4 100644 --- a/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp +++ b/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp @@ -363,7 +363,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenBlockedQueueWhenParent cl_queue_properties properties[3] = {0}; MockMultiDispatchInfo multiDispatchInfo(pKernel); - MockDeviceQueueHw mockDevQueue(context, pDevice, properties[0]); + MockDeviceQueueHw mockDevQueue(context, pClDevice, properties[0]); context->setDefaultDeviceQueue(&mockDevQueue); // Acquire CS to check if reset queue was called @@ -565,7 +565,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelEnqueueFixture, ParentKernelEnqueuedWith DebugManagerStateRestore dbgRestorer; DebugManager.flags.SchedulerSimulationReturnInstance.set(1); - MockDeviceQueueHw *mockDeviceQueueHw = new MockDeviceQueueHw(context, pDevice, DeviceHostQueue::deviceQueueProperties::minimumProperties[0]); + MockDeviceQueueHw *mockDeviceQueueHw = new MockDeviceQueueHw(context, pClDevice, DeviceHostQueue::deviceQueueProperties::minimumProperties[0]); mockDeviceQueueHw->resetDeviceQueue(); context->setDefaultDeviceQueue(mockDeviceQueueHw); @@ -600,7 +600,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelEnqueueFixture, givenCsrInBatchingModeWh size_t offset[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockContext context(pDevice); + MockContext context(pClDevice); std::unique_ptr kernelToRun(MockParentKernel::create(context, false, false, false, false, false)); pCmdQ->enqueueKernel(kernelToRun.get(), 1, offset, gws, gws, 0, nullptr, nullptr); diff --git a/unit_tests/execution_model/scheduler_dispatch_tests.cpp b/unit_tests/execution_model/scheduler_dispatch_tests.cpp index fa014d4b58..fa02770b23 100644 --- a/unit_tests/execution_model/scheduler_dispatch_tests.cpp +++ b/unit_tests/execution_model/scheduler_dispatch_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -249,7 +249,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ExecutionModelSchedulerFixture, ForceDispatchSchedul size_t offset[3] = {0, 0, 0}; size_t gws[3] = {1, 1, 1}; - MockCommandQueueHw *mockCmdQ = new MockCommandQueueHw(context, pDevice, 0); + MockCommandQueueHw *mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); mockCmdQ->enqueueKernel(parentKernel, 1, offset, gws, gws, 0, nullptr, nullptr); diff --git a/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp b/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp index 96a5d6b361..03c0dd4aec 100644 --- a/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp +++ b/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,7 +36,7 @@ class MockDeviceQueueHwWithCriticalSectionRelease : public DeviceQueueHwmemoryManager.reset(memoryManager); - device = std::unique_ptr(Device::create(executionEnvironment, 0)); + device = std::make_unique(MockDevice::create(executionEnvironment, 0)); context = std::make_unique(device.get()); @@ -64,7 +64,7 @@ struct BufferEnqueueFixture : public HardwareParse, ExecutionEnvironment *executionEnvironment; cl_queue_properties properties = {}; std::unique_ptr bufferMemory; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr buffer; diff --git a/unit_tests/fixtures/context_fixture.cpp b/unit_tests/fixtures/context_fixture.cpp index cf35fdede5..f9e10329d6 100644 --- a/unit_tests/fixtures/context_fixture.cpp +++ b/unit_tests/fixtures/context_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ ContextFixture::ContextFixture() void ContextFixture::SetUp(cl_uint numDevices, cl_device_id *pDeviceList) { auto retVal = CL_SUCCESS; - pContext = Context::create(nullptr, DeviceVector(pDeviceList, numDevices), + pContext = Context::create(nullptr, ClDeviceVector(pDeviceList, numDevices), nullptr, nullptr, retVal); ASSERT_NE(nullptr, pContext); ASSERT_EQ(CL_SUCCESS, retVal); diff --git a/unit_tests/fixtures/d3d_test_fixture.h b/unit_tests/fixtures/d3d_test_fixture.h index 5964459e06..18c8016ff1 100644 --- a/unit_tests/fixtures/d3d_test_fixture.h +++ b/unit_tests/fixtures/d3d_test_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -82,7 +82,7 @@ class D3DTests : public PlatformFixture, public ::testing::Test { void SetUp() override { PlatformFixture::SetUp(); - context = new MockContext(pPlatform->getDevice(0)); + context = new MockContext(pPlatform->getClDevice(0)); context->preferD3dSharedResources = true; mockMM = std::make_unique(*context->getDevice(0)->getExecutionEnvironment()); diff --git a/unit_tests/fixtures/device_fixture.cpp b/unit_tests/fixtures/device_fixture.cpp index 276a25a4b7..e444c210e8 100644 --- a/unit_tests/fixtures/device_fixture.cpp +++ b/unit_tests/fixtures/device_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,6 +18,8 @@ void DeviceFixture::SetUp() { void DeviceFixture::SetUpImpl(const NEO::HardwareInfo *hardwareInfo) { pDevice = MockDevice::createWithNewExecutionEnvironment(hardwareInfo); ASSERT_NE(nullptr, pDevice); + pClDevice = new MockClDevice{pDevice}; + ASSERT_NE(nullptr, pClDevice); auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); pTagMemory = commandStreamReceiver.getTagAddress(); @@ -25,7 +27,8 @@ void DeviceFixture::SetUpImpl(const NEO::HardwareInfo *hardwareInfo) { } void DeviceFixture::TearDown() { - delete pDevice; + delete pClDevice; + pClDevice = nullptr; pDevice = nullptr; } diff --git a/unit_tests/fixtures/device_fixture.h b/unit_tests/fixtures/device_fixture.h index 087ab7fd90..6aed2bfa66 100644 --- a/unit_tests/fixtures/device_fixture.h +++ b/unit_tests/fixtures/device_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,6 +19,7 @@ struct DeviceFixture { MockDevice *createWithUsDeviceId(unsigned short usDeviceId); MockDevice *pDevice = nullptr; + MockClDevice *pClDevice = nullptr; volatile uint32_t *pTagMemory = nullptr; HardwareInfo hardwareInfo = {}; PLATFORM platformHelper = {}; diff --git a/unit_tests/fixtures/device_host_queue_fixture.h b/unit_tests/fixtures/device_host_queue_fixture.h index c3644aedea..fc9fcf02b5 100644 --- a/unit_tests/fixtures/device_host_queue_fixture.h +++ b/unit_tests/fixtures/device_host_queue_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -56,7 +56,7 @@ class DeviceQueueHwTest : public DeviceHostQueueFixture { using BaseClass = DeviceHostQueueFixture; void SetUp() override { BaseClass::SetUp(); - device = castToObject(devices[testedRootDeviceIndex]); + device = castToObject(devices[testedRootDeviceIndex]); ASSERT_NE(device, nullptr); if (!device->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) { GTEST_SKIP(); @@ -84,6 +84,6 @@ class DeviceQueueHwTest : public DeviceHostQueueFixture { } DeviceQueue *deviceQueue; - Device *device; + ClDevice *device; }; } // namespace DeviceHostQueue diff --git a/unit_tests/fixtures/device_info_fixture.h b/unit_tests/fixtures/device_info_fixture.h index dfca397e7e..00e8ef9198 100644 --- a/unit_tests/fixtures/device_info_fixture.h +++ b/unit_tests/fixtures/device_info_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ struct GetDeviceInfoMemCapabilitiesTest : ::testing::Test { }; void check(std::vector ¶ms) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); for (auto param : params) { cl_unified_shared_memory_capabilities_intel unifiedSharedMemoryCapabilities{}; diff --git a/unit_tests/fixtures/device_instrumentation_fixture.cpp b/unit_tests/fixtures/device_instrumentation_fixture.cpp index 786421f127..f5778fa9c3 100644 --- a/unit_tests/fixtures/device_instrumentation_fixture.cpp +++ b/unit_tests/fixtures/device_instrumentation_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,6 +14,7 @@ namespace NEO { void DeviceInstrumentationFixture::SetUp(bool instrumentation) { ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1); hwInfo->capabilityTable.instrumentationEnabled = instrumentation; - device = std::unique_ptr(Device::create(executionEnvironment, 0)); + device = std::make_unique(*Device::create(executionEnvironment, 0)); } + } // namespace NEO diff --git a/unit_tests/fixtures/device_instrumentation_fixture.h b/unit_tests/fixtures/device_instrumentation_fixture.h index 378ef293cc..a147b087e0 100644 --- a/unit_tests/fixtures/device_instrumentation_fixture.h +++ b/unit_tests/fixtures/device_instrumentation_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,13 +9,14 @@ namespace NEO { +class ClDevice; class Device; struct HardwareInfo; struct DeviceInstrumentationFixture { void SetUp(bool instrumentation); - std::unique_ptr device = nullptr; + std::unique_ptr device = nullptr; HardwareInfo *hwInfo = nullptr; }; -} // namespace NEO \ No newline at end of file +} // namespace NEO diff --git a/unit_tests/fixtures/dispatch_flags_fixture.h b/unit_tests/fixtures/dispatch_flags_fixture.h index f90ea38aa3..039aac1626 100644 --- a/unit_tests/fixtures/dispatch_flags_fixture.h +++ b/unit_tests/fixtures/dispatch_flags_fixture.h @@ -18,12 +18,12 @@ struct DispatchFlagsTests : public ::testing::Test { template void SetUpImpl() { environmentWrapper.setCsrType(); - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context = std::make_unique(device.get()); } EnvironmentWithCsrWrapper environmentWrapper; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; DebugManagerStateRestore restore; }; diff --git a/unit_tests/fixtures/enqueue_handler_fixture.h b/unit_tests/fixtures/enqueue_handler_fixture.h index bdd57f7131..0f8df5774d 100644 --- a/unit_tests/fixtures/enqueue_handler_fixture.h +++ b/unit_tests/fixtures/enqueue_handler_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,7 +16,7 @@ class EnqueueHandlerTest : public NEO::DeviceFixture, public: void SetUp() override { DeviceFixture::SetUp(); - context = new NEO::MockContext(pDevice); + context = new NEO::MockContext(pClDevice); } void TearDown() override { diff --git a/unit_tests/fixtures/execution_model_fixture.h b/unit_tests/fixtures/execution_model_fixture.h index df23904a16..022860a4eb 100644 --- a/unit_tests/fixtures/execution_model_fixture.h +++ b/unit_tests/fixtures/execution_model_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,7 +15,7 @@ class DeviceQueueFixture { public: - void SetUp(Context *context, Device *device) { + void SetUp(Context *context, ClDevice *device) { cl_int errcodeRet = 0; cl_queue_properties properties[3]; @@ -54,8 +54,8 @@ class ExecutionModelKernelTest : public ExecutionModelKernelFixture, void SetUp() override { DebugManager.flags.EnableTimestampPacket.set(0); ExecutionModelKernelFixture::SetUp(); - CommandQueueHwFixture::SetUp(pDevice, 0); - DeviceQueueFixture::SetUp(context, pDevice); + CommandQueueHwFixture::SetUp(pClDevice, 0); + DeviceQueueFixture::SetUp(context, pClDevice); } void TearDown() override { @@ -85,8 +85,8 @@ class ExecutionModelSchedulerTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueHwFixture::SetUp(pDevice, 0); - DeviceQueueFixture::SetUp(context, pDevice); + CommandQueueHwFixture::SetUp(pClDevice, 0); + DeviceQueueFixture::SetUp(context, pClDevice); parentKernel = MockParentKernel::create(*context); ASSERT_NE(nullptr, parentKernel); @@ -107,7 +107,7 @@ struct ParentKernelCommandQueueFixture : public CommandQueueHwFixture, testing::Test { void SetUp() override { - device = MockDevice::createWithNewExecutionEnvironment(nullptr); + device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; CommandQueueHwFixture::SetUp(device, 0); } void TearDown() override { @@ -124,5 +124,5 @@ struct ParentKernelCommandQueueFixture : public CommandQueueHwFixture, return std::make_unique(commandStream, *gpgpuCsr.getInternalAllocationStorage()); } - MockDevice *device; + MockClDevice *device; }; diff --git a/unit_tests/fixtures/execution_model_kernel_fixture.h b/unit_tests/fixtures/execution_model_kernel_fixture.h index b599cc4caf..8b9bb6c8c6 100644 --- a/unit_tests/fixtures/execution_model_kernel_fixture.h +++ b/unit_tests/fixtures/execution_model_kernel_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,6 +33,7 @@ class ExecutionModelKernelFixture : public ProgramFromBinaryTest, if (temp.find("OpenCL 1.2") != std::string::npos) { pDevice = MockDevice::createWithNewExecutionEnvironment(nullptr); + pClDevice = new MockClDevice{pDevice}; return; } @@ -43,7 +44,7 @@ class ExecutionModelKernelFixture : public ProgramFromBinaryTest, ASSERT_NE(nullptr, pProgram); ASSERT_EQ(CL_SUCCESS, retVal); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; retVal = pProgram->build( 1, &device, @@ -79,6 +80,10 @@ class ExecutionModelKernelFixture : public ProgramFromBinaryTest, delete pDevice; pDevice = nullptr; } + if (pClDevice != nullptr) { + delete pClDevice; + pClDevice = nullptr; + } } } diff --git a/unit_tests/fixtures/hello_world_fixture.h b/unit_tests/fixtures/hello_world_fixture.h index 5ec19ccd0a..b81b65f634 100644 --- a/unit_tests/fixtures/hello_world_fixture.h +++ b/unit_tests/fixtures/hello_world_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -59,17 +59,17 @@ struct HelloWorldFixture : public FixtureFactory::IndirectHeapFixture, public: virtual void SetUp() { DeviceFixture::SetUp(); - ASSERT_NE(nullptr, pDevice); - CommandQueueFixture::SetUp(pDevice, 0); + ASSERT_NE(nullptr, pClDevice); + CommandQueueFixture::SetUp(pClDevice, 0); ASSERT_NE(nullptr, pCmdQ); CommandStreamFixture::SetUp(pCmdQ); ASSERT_NE(nullptr, pCS); IndirectHeapFixture::SetUp(pCmdQ); - KernelFixture::SetUp(pDevice, kernelFilename, kernelName); + KernelFixture::SetUp(pClDevice, kernelFilename, kernelName); ASSERT_NE(nullptr, pKernel); auto retVal = CL_INVALID_VALUE; - BufferDefaults::context = new MockContext(pDevice); + BufferDefaults::context = new MockContext(pClDevice); destBuffer = Buffer::create( BufferDefaults::context, diff --git a/unit_tests/fixtures/hello_world_kernel_fixture.h b/unit_tests/fixtures/hello_world_kernel_fixture.h index e5e5b059bd..9ebae97fbf 100644 --- a/unit_tests/fixtures/hello_world_kernel_fixture.h +++ b/unit_tests/fixtures/hello_world_kernel_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -29,7 +29,7 @@ class Program; struct HelloWorldKernelFixture : public ProgramFixture { using ProgramFixture::SetUp; - virtual void SetUp(Device *pDevice, const char *kernelFilenameStr, const char *kernelNameStr, const char *options = nullptr) { + virtual void SetUp(ClDevice *pDevice, const char *kernelFilenameStr, const char *kernelNameStr, const char *options = nullptr) { ProgramFixture::SetUp(); pTestFilename = new std::string(kernelFilenameStr); @@ -40,7 +40,7 @@ struct HelloWorldKernelFixture : public ProgramFixture { } cl_device_id device = pDevice; - pContext = Context::create(nullptr, DeviceVector(&device, 1), nullptr, nullptr, retVal); + pContext = Context::create(nullptr, ClDeviceVector(&device, 1), nullptr, nullptr, retVal); ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, pContext); diff --git a/unit_tests/fixtures/kernel_arg_fixture.cpp b/unit_tests/fixtures/kernel_arg_fixture.cpp index 81b8a10d44..f04ca7b4cd 100644 --- a/unit_tests/fixtures/kernel_arg_fixture.cpp +++ b/unit_tests/fixtures/kernel_arg_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -56,7 +56,7 @@ void KernelImageArgTest::SetUp() { DeviceFixture::SetUp(); program = std::make_unique(*pDevice->getExecutionEnvironment()); - pKernel.reset(new NEO::MockKernel(program.get(), *pKernelInfo, *pDevice)); + pKernel.reset(new NEO::MockKernel(program.get(), *pKernelInfo, *pClDevice)); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setKernelArgHandler(0, &NEO::Kernel::setArgImage); @@ -69,7 +69,7 @@ void KernelImageArgTest::SetUp() { crossThreadData[0x20 / sizeof(uint32_t)] = 0x12344321; pKernel->setCrossThreadData(crossThreadData, sizeof(crossThreadData)); - context.reset(new NEO::MockContext(pDevice)); + context.reset(new NEO::MockContext(pClDevice)); image.reset(Image2dHelper<>::create(context.get())); pKernel->setContext(context.get()); ASSERT_NE(nullptr, image); diff --git a/unit_tests/fixtures/memory_allocator_fixture.h b/unit_tests/fixtures/memory_allocator_fixture.h index 991fb7c1be..265efcf0e0 100644 --- a/unit_tests/fixtures/memory_allocator_fixture.h +++ b/unit_tests/fixtures/memory_allocator_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,6 +36,7 @@ class MemoryAllocatorFixture : public MemoryManagementFixture { void TearDown() override { device.reset(); + platformImpl.reset(); MemoryManagementFixture::TearDown(); } diff --git a/unit_tests/fixtures/multi_root_device_fixture.h b/unit_tests/fixtures/multi_root_device_fixture.h index faedb216a4..5872b0d884 100644 --- a/unit_tests/fixtures/multi_root_device_fixture.h +++ b/unit_tests/fixtures/multi_root_device_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,14 +16,14 @@ class MultiRootDeviceFixture : public ::testing::Test { public: void SetUp() override { DebugManager.flags.CreateMultipleRootDevices.set(2 * expectedRootDeviceIndex); - device.reset(MockDevice::createWithNewExecutionEnvironment(nullptr, expectedRootDeviceIndex)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr, expectedRootDeviceIndex)); context.reset(new MockContext(device.get())); mockMemoryManager = reinterpret_cast(device->getMemoryManager()); } const uint32_t expectedRootDeviceIndex = 1; DebugManagerStateRestore restorer; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; MockMemoryManager *mockMemoryManager; }; diff --git a/unit_tests/fixtures/platform_fixture.cpp b/unit_tests/fixtures/platform_fixture.cpp index 8624b8b3cf..7f219c2e3d 100644 --- a/unit_tests/fixtures/platform_fixture.cpp +++ b/unit_tests/fixtures/platform_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,7 +30,7 @@ void PlatformFixture::SetUp() { num_devices = static_cast(pPlatform->getNumDevices()); ASSERT_GT(num_devices, 0u); - auto allDev = pPlatform->getDevices(); + auto allDev = pPlatform->getClDevices(); ASSERT_NE(nullptr, allDev); devices = new cl_device_id[num_devices]; diff --git a/unit_tests/fixtures/scenario_test_fixture.h b/unit_tests/fixtures/scenario_test_fixture.h index 163a6ccde4..92e5edbb8b 100644 --- a/unit_tests/fixtures/scenario_test_fixture.h +++ b/unit_tests/fixtures/scenario_test_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,11 +27,11 @@ class ScenarioTest : public ::testing::Test, DebugManager.flags.EnableTimestampPacket.set(false); PlatformFixture::SetUp(); - auto pDevice = pPlatform->getDevice(0); + auto pDevice = pPlatform->getClDevice(0); ASSERT_NE(nullptr, pDevice); cl_device_id clDevice = pDevice; - context = Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal); + context = Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal); commandQueue = new MockCommandQueue(context, pDevice, 0); program = new MockProgram(*pDevice->getExecutionEnvironment(), context, false); diff --git a/unit_tests/fixtures/simple_arg_kernel_fixture.h b/unit_tests/fixtures/simple_arg_kernel_fixture.h index 47043ade6c..3815570a7d 100644 --- a/unit_tests/fixtures/simple_arg_kernel_fixture.h +++ b/unit_tests/fixtures/simple_arg_kernel_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -78,7 +78,7 @@ class SimpleArgKernelFixture : public ProgramFixture { } protected: - virtual void SetUp(Device *pDevice) { + virtual void SetUp(ClDevice *pDevice) { ProgramFixture::SetUp(); std::string testFile; @@ -93,7 +93,7 @@ class SimpleArgKernelFixture : public ProgramFixture { } cl_device_id device = pDevice; - pContext = Context::create(nullptr, DeviceVector(&device, 1), nullptr, nullptr, retVal); + pContext = Context::create(nullptr, ClDeviceVector(&device, 1), nullptr, nullptr, retVal); ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, pContext); @@ -146,7 +146,7 @@ class SimpleArgNonUniformKernelFixture : public ProgramFixture { } protected: - void SetUp(Device *device, Context *context) { + void SetUp(ClDevice *device, Context *context) { ProgramFixture::SetUp(); cl_device_id deviceId = device; @@ -194,7 +194,7 @@ class SimpleKernelFixture : public ProgramFixture { using ProgramFixture::SetUp; protected: - void SetUp(Device *device, Context *context) { + void SetUp(ClDevice *device, Context *context) { ProgramFixture::SetUp(); cl_device_id deviceId = device; @@ -252,7 +252,7 @@ class SimpleKernelStatelessFixture : public ProgramFixture { SimpleKernelStatelessFixture() = default; protected: - void SetUp(Device *device, Context *context) { + void SetUp(ClDevice *device, Context *context) { ProgramFixture::SetUp(); cl_device_id deviceId = device; cl_context clContext = context; diff --git a/unit_tests/gen11/enqueue_kernel_gen11.cpp b/unit_tests/gen11/enqueue_kernel_gen11.cpp index ba77c22d7c..0c2302c514 100644 --- a/unit_tests/gen11/enqueue_kernel_gen11.cpp +++ b/unit_tests/gen11/enqueue_kernel_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,10 +19,10 @@ namespace NEO { using Gen11EnqueueTest = Test; GEN11TEST_F(Gen11EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKernelIsSubmittedThenDefaultPolicyIsProgrammed) { MockContext mc; - CommandQueueHw cmdQ{&mc, pDevice, 0}; + CommandQueueHw cmdQ{&mc, pClDevice, 0}; SPatchExecutionEnvironment executionEnvironment = {}; executionEnvironment.SubgroupIndependentForwardProgressRequired = true; - MockKernelWithInternals mockKernel(*pDevice, executionEnvironment); + MockKernelWithInternals mockKernel(*pClDevice, executionEnvironment); cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr); @@ -37,10 +37,10 @@ GEN11TEST_F(Gen11EnqueueTest, givenKernelRequiringIndependentForwardProgressWhen GEN11TEST_F(Gen11EnqueueTest, givenKernelNotRequiringIndependentForwardProgressWhenKernelIsSubmittedThenAgeBasedPolicyIsProgrammed) { MockContext mc; - CommandQueueHw cmdQ{&mc, pDevice, 0}; + CommandQueueHw cmdQ{&mc, pClDevice, 0}; SPatchExecutionEnvironment executionEnvironment = {}; executionEnvironment.SubgroupIndependentForwardProgressRequired = false; - MockKernelWithInternals mockKernel(*pDevice, executionEnvironment); + MockKernelWithInternals mockKernel(*pClDevice, executionEnvironment); cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr); diff --git a/unit_tests/gen11/kernel_tests_gen11.cpp b/unit_tests/gen11/kernel_tests_gen11.cpp index 265e509580..b0175abc6f 100644 --- a/unit_tests/gen11/kernel_tests_gen11.cpp +++ b/unit_tests/gen11/kernel_tests_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,7 @@ using namespace NEO; using Gen11KernelTest = Test; GEN11TEST_F(Gen11KernelTest, givenKernelWhenCanTransformImagesIsCalledThenReturnsTrue) { - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto retVal = mockKernel.mockKernel->Kernel::canTransformImages(); EXPECT_TRUE(retVal); } diff --git a/unit_tests/gen12lp/command_stream_receiver_hw_tests_gen12lp.inl b/unit_tests/gen12lp/command_stream_receiver_hw_tests_gen12lp.inl index a9f1f00d64..bda87a7083 100644 --- a/unit_tests/gen12lp/command_stream_receiver_hw_tests_gen12lp.inl +++ b/unit_tests/gen12lp/command_stream_receiver_hw_tests_gen12lp.inl @@ -30,9 +30,9 @@ using CommandStreamReceiverHwTestGen12lp = CommandStreamReceiverHwTest commandQueue(&ctx, pDevice, 0); + MockContext ctx(pClDevice); + MockKernelWithInternals kernel(*pClDevice); + CommandQueueHw commandQueue(&ctx, pClDevice, 0); auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); auto &commandStreamCSR = commandStreamReceiver->getCS(); diff --git a/unit_tests/gen12lp/device_queue_tests_gen12lp.cpp b/unit_tests/gen12lp/device_queue_tests_gen12lp.cpp index 414a896806..dbc6206aaf 100644 --- a/unit_tests/gen12lp/device_queue_tests_gen12lp.cpp +++ b/unit_tests/gen12lp/device_queue_tests_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,19 +25,19 @@ GEN12LPTEST_F(DeviceQueueHwTest, givenDeviceQueueWhenRunningOnCCsThenFfidSkipOff const_cast(device->getHardwareInfo()).platform.usRevId = REVISION_A0; uint64_t expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch() + blockInfo->patchInfo.threadPayload->OffsetToSkipSetFFIDGP; - uint64_t offset = MockDeviceQueueHw::getBlockKernelStartPointer(*device, blockInfo, true); + uint64_t offset = MockDeviceQueueHw::getBlockKernelStartPointer(device->getDevice(), blockInfo, true); EXPECT_EQ(expectedOffset, offset); expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch(); - offset = MockDeviceQueueHw::getBlockKernelStartPointer(*device, blockInfo, false); + offset = MockDeviceQueueHw::getBlockKernelStartPointer(device->getDevice(), blockInfo, false); EXPECT_EQ(expectedOffset, offset); const_cast(device->getHardwareInfo()).platform.usRevId = REVISION_B; expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch(); - offset = MockDeviceQueueHw::getBlockKernelStartPointer(*device, blockInfo, true); + offset = MockDeviceQueueHw::getBlockKernelStartPointer(device->getDevice(), blockInfo, true); EXPECT_EQ(expectedOffset, offset); - offset = MockDeviceQueueHw::getBlockKernelStartPointer(*device, blockInfo, false); + offset = MockDeviceQueueHw::getBlockKernelStartPointer(device->getDevice(), blockInfo, false); EXPECT_EQ(expectedOffset, offset); } diff --git a/unit_tests/gen12lp/hardware_commands_helper_tests_gen12lp.inl b/unit_tests/gen12lp/hardware_commands_helper_tests_gen12lp.inl index c6eba0121a..5ce76d2356 100644 --- a/unit_tests/gen12lp/hardware_commands_helper_tests_gen12lp.inl +++ b/unit_tests/gen12lp/hardware_commands_helper_tests_gen12lp.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,7 +25,7 @@ TGLLPTEST_F(HardwareCommandsGen12LpTests, GivenUseOffsetToSkipSetFFIDGPWorkaroun for (auto stepping : steppings) { hwInfo.platform.usRevId = stepping; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); MockKernelWithInternals mockKernelWithInternals{*device}; mockKernelWithInternals.kernelInfo.patchInfo.threadPayload = &threadPayload; diff --git a/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl b/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl index 54fac8041b..1331b58497 100644 --- a/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl +++ b/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl @@ -113,13 +113,13 @@ class HwHelperTestsGen12LpBuffer : public ::testing::Test { public: void SetUp() override { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - device.reset(Device::create(executionEnvironment, 0u)); + device = std::make_unique(Device::create(executionEnvironment, 0u)); context = std::make_unique(device.get(), true); context->contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; } cl_int retVal = CL_SUCCESS; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr buffer; }; diff --git a/unit_tests/gen12lp/kernel_tests_gen12lp.inl b/unit_tests/gen12lp/kernel_tests_gen12lp.inl index 0d3f2418fe..8973ca07e1 100644 --- a/unit_tests/gen12lp/kernel_tests_gen12lp.inl +++ b/unit_tests/gen12lp/kernel_tests_gen12lp.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,7 @@ using namespace NEO; using Gen12LpKernelTest = Test; GEN12LPTEST_F(Gen12LpKernelTest, givenKernelWhenCanTransformImagesIsCalledThenReturnsTrue) { - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto retVal = mockKernel.mockKernel->Kernel::canTransformImages(); EXPECT_FALSE(retVal); } diff --git a/unit_tests/gen12lp/profiling_tests_gen12lp.inl b/unit_tests/gen12lp/profiling_tests_gen12lp.inl index 46c2d2fa2f..3f480c24ba 100644 --- a/unit_tests/gen12lp/profiling_tests_gen12lp.inl +++ b/unit_tests/gen12lp/profiling_tests_gen12lp.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,7 +17,7 @@ struct ProfilingTestsGen12LP : public CommandEnqueueFixture, public ::testing::Test { void SetUp() override { CommandEnqueueFixture::SetUp(CL_QUEUE_PROFILING_ENABLE); - mockKernelWithInternals = std::make_unique(*pDevice, nullptr); + mockKernelWithInternals = std::make_unique(*pClDevice, nullptr); } void TearDown() override { @@ -74,4 +74,4 @@ GEN12LPTEST_F(ProfilingTestsGen12LP, GivenCommandQueueWithProflingWhenWalkerIsDi EXPECT_EQ(nullptr, pAfterMI); clReleaseEvent(event); -} \ No newline at end of file +} diff --git a/unit_tests/gen8/kernel_tests_gen8.cpp b/unit_tests/gen8/kernel_tests_gen8.cpp index 9f061cfcb7..818b6996b8 100644 --- a/unit_tests/gen8/kernel_tests_gen8.cpp +++ b/unit_tests/gen8/kernel_tests_gen8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,7 @@ using namespace NEO; using Gen8KernelTest = Test; GEN8TEST_F(Gen8KernelTest, givenKernelWhenCanTransformImagesIsCalledThenReturnsFalse) { - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto retVal = mockKernel.mockKernel->Kernel::canTransformImages(); EXPECT_FALSE(retVal); } diff --git a/unit_tests/gen9/enqueue_kernel_gen9.cpp b/unit_tests/gen9/enqueue_kernel_gen9.cpp index 0d8b9ffba2..863020c1e7 100644 --- a/unit_tests/gen9/enqueue_kernel_gen9.cpp +++ b/unit_tests/gen9/enqueue_kernel_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,10 +19,10 @@ namespace NEO { using Gen9EnqueueTest = Test; GEN9TEST_F(Gen9EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKernelIsSubmittedThenRoundRobinPolicyIsProgrammed) { MockContext mc; - CommandQueueHw cmdQ{&mc, pDevice, 0}; + CommandQueueHw cmdQ{&mc, pClDevice, 0}; SPatchExecutionEnvironment executionEnvironment = {}; executionEnvironment.SubgroupIndependentForwardProgressRequired = true; - MockKernelWithInternals mockKernel(*pDevice, executionEnvironment); + MockKernelWithInternals mockKernel(*pClDevice, executionEnvironment); cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr); @@ -37,10 +37,10 @@ GEN9TEST_F(Gen9EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKe GEN9TEST_F(Gen9EnqueueTest, givenKernelNotRequiringIndependentForwardProgressWhenKernelIsSubmittedThenAgeBasedPolicyIsProgrammed) { MockContext mc; - CommandQueueHw cmdQ{&mc, pDevice, 0}; + CommandQueueHw cmdQ{&mc, pClDevice, 0}; SPatchExecutionEnvironment executionEnvironment = {}; executionEnvironment.SubgroupIndependentForwardProgressRequired = false; - MockKernelWithInternals mockKernel(*pDevice, executionEnvironment); + MockKernelWithInternals mockKernel(*pClDevice, executionEnvironment); cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr); diff --git a/unit_tests/gen9/kernel_tests_gen9.cpp b/unit_tests/gen9/kernel_tests_gen9.cpp index ea379e9124..4b5d9f5b64 100644 --- a/unit_tests/gen9/kernel_tests_gen9.cpp +++ b/unit_tests/gen9/kernel_tests_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,7 +15,7 @@ using namespace NEO; using Gen9KernelTest = Test; GEN9TEST_F(Gen9KernelTest, givenKernelWhenCanTransformImagesIsCalledThenReturnsTrue) { - MockKernelWithInternals mockKernel(*pDevice); + MockKernelWithInternals mockKernel(*pClDevice); auto retVal = mockKernel.mockKernel->Kernel::canTransformImages(); EXPECT_TRUE(retVal); } diff --git a/unit_tests/global_environment.cpp b/unit_tests/global_environment.cpp index 23b31fdb18..b6ad50abeb 100644 --- a/unit_tests/global_environment.cpp +++ b/unit_tests/global_environment.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -47,7 +47,11 @@ void TestEnvironment::fclPushDebugVars( void TestEnvironment::fclPopDebugVars() { fclDebugVarStack.pop_back(); - NEO::setFclDebugVars(fclDebugVarStack.back()); + if (fclDebugVarStack.empty()) { + NEO::clearFclDebugVars(); + } else { + NEO::setFclDebugVars(fclDebugVarStack.back()); + } } void TestEnvironment::igcPushDebugVars( @@ -58,7 +62,11 @@ void TestEnvironment::igcPushDebugVars( void TestEnvironment::igcPopDebugVars() { igcDebugVarStack.pop_back(); - NEO::setIgcDebugVars(igcDebugVarStack.back()); + if (igcDebugVarStack.empty()) { + NEO::clearIgcDebugVars(); + } else { + NEO::setIgcDebugVars(igcDebugVarStack.back()); + } } void TestEnvironment::setDefaultDebugVars( diff --git a/unit_tests/gtpin/gtpin_tests.cpp b/unit_tests/gtpin/gtpin_tests.cpp index 5fea0acdd3..610a2add41 100644 --- a/unit_tests/gtpin/gtpin_tests.cpp +++ b/unit_tests/gtpin/gtpin_tests.cpp @@ -150,7 +150,7 @@ class GTPinFixture : public ContextFixture, public MemoryManagementFixture { memoryManager = new MockMemoryManagerWithFailures(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); pPlatform->initialize(); - pDevice = pPlatform->getDevice(0); + pDevice = pPlatform->getClDevice(0); cl_device_id device = (cl_device_id)pDevice; ContextFixture::SetUp(1, &device); @@ -178,7 +178,7 @@ class GTPinFixture : public ContextFixture, public MemoryManagementFixture { } Platform *pPlatform = nullptr; - Device *pDevice = nullptr; + ClDevice *pDevice = nullptr; cl_int retVal = CL_SUCCESS; GTPIN_DI_STATUS retFromGtPin = GTPIN_DI_SUCCESS; driver_services_t driverServices; @@ -2441,7 +2441,7 @@ TEST_F(ProgramTests, givenGenBinaryWithGtpinInfoWhenProcessGenBinaryCalledThenGt EXPECT_EQ((uint32_t)CL_PROGRAM_BINARY_TYPE_EXECUTABLE, (uint32_t)pProgram->getProgramBinaryType()); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); char *pBin = &genBin[0]; retVal = CL_INVALID_BINARY; binSize = 0; diff --git a/unit_tests/helpers/built_ins_helper.cpp b/unit_tests/helpers/built_ins_helper.cpp index 609bf471af..a2024dcfd2 100644 --- a/unit_tests/helpers/built_ins_helper.cpp +++ b/unit_tests/helpers/built_ins_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,7 +22,7 @@ SipKernelType calledType = SipKernelType::COUNT; bool called = false; } // namespace MockSipData -const SipKernel &initSipKernel(SipKernelType type, Device &device) { +const SipKernel &initSipKernel(SipKernelType type, ClDevice &device) { MockSipData::calledType = type; MockSipData::mockSipKernel->type = type; MockSipData::called = true; diff --git a/unit_tests/helpers/dispatch_info_builder_tests.cpp b/unit_tests/helpers/dispatch_info_builder_tests.cpp index 26fa323bba..6f7919f7d2 100644 --- a/unit_tests/helpers/dispatch_info_builder_tests.cpp +++ b/unit_tests/helpers/dispatch_info_builder_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -28,7 +28,7 @@ class DispatchInfoBuilderFixture : public ContextFixture, public DeviceFixture { protected: void SetUp() { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); pKernelInfo = std::make_unique(); @@ -67,7 +67,7 @@ class DispatchInfoBuilderFixture : public ContextFixture, public DeviceFixture { pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); pKernel->setKernelArgHandler(0, &Kernel::setArgBuffer); diff --git a/unit_tests/helpers/dispatch_info_tests.cpp b/unit_tests/helpers/dispatch_info_tests.cpp index 829f968e4c..97ff05e432 100644 --- a/unit_tests/helpers/dispatch_info_tests.cpp +++ b/unit_tests/helpers/dispatch_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,7 @@ class DispatchInfoFixture : public ContextFixture, public DeviceFixture { protected: void SetUp() { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); pKernelInfo = std::make_unique(); @@ -39,7 +39,7 @@ class DispatchInfoFixture : public ContextFixture, public DeviceFixture { pKernelInfo->patchInfo.pAllocateStatelessPrintfSurface = pPrintfSurface; pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); pKernel->slmTotalSize = 128; } void TearDown() override { diff --git a/unit_tests/helpers/hardware_commands_helper_tests.cpp b/unit_tests/helpers/hardware_commands_helper_tests.cpp index 2ffd4b133a..59f759f5dc 100644 --- a/unit_tests/helpers/hardware_commands_helper_tests.cpp +++ b/unit_tests/helpers/hardware_commands_helper_tests.cpp @@ -26,14 +26,14 @@ using namespace NEO; void HardwareCommandsTest::SetUp() { DeviceFixture::SetUp(); - ASSERT_NE(nullptr, pDevice); - cl_device_id device = pDevice; + ASSERT_NE(nullptr, pClDevice); + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); ASSERT_NE(nullptr, pContext); BuiltInFixture::SetUp(pDevice); ASSERT_NE(nullptr, pBuiltIns); - mockKernelWithInternal = std::make_unique(*pDevice, pContext); + mockKernelWithInternal = std::make_unique(*pClDevice, pContext); } void HardwareCommandsTest::TearDown() { @@ -56,7 +56,7 @@ void HardwareCommandsTest::addSpaceForSingleKernelArg() { } HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, programInterfaceDescriptorDataResourceUsage) { - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); std::unique_ptr srcImage(Image2dHelper<>::create(pContext)); ASSERT_NE(nullptr, srcImage.get()); @@ -94,7 +94,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, programInterfaceDescriptorData } HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, programMediaInterfaceDescriptorLoadResourceUsage) { - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); typedef typename FamilyType::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA; typedef typename FamilyType::MEDIA_INTERFACE_DESCRIPTOR_LOAD MEDIA_INTERFACE_DESCRIPTOR_LOAD; @@ -112,7 +112,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, programMediaInterfaceDescripto } HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, programMediaStateFlushResourceUsage) { - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); typedef typename FamilyType::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA; typedef typename FamilyType::MEDIA_STATE_FLUSH MEDIA_STATE_FLUSH; @@ -128,7 +128,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, programMediaStateFlushResource } HWTEST_F(HardwareCommandsTest, sendCrossThreadDataResourceUsage) { - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); std::unique_ptr srcImage(Image2dHelper<>::create(pContext)); ASSERT_NE(nullptr, srcImage.get()); @@ -167,14 +167,14 @@ HWTEST_F(HardwareCommandsTest, sendCrossThreadDataResourceUsage) { } HWTEST_F(HardwareCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoCommentsForAUBDumpIsNotSetThenAddPatchInfoDataOffsetsAreNotMoved) { - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); auto kernelInfo = std::make_unique(); - std::unique_ptr kernel(new MockKernel(&program, *kernelInfo, *pDevice)); + std::unique_ptr kernel(new MockKernel(&program, *kernelInfo, *pClDevice)); auto &indirectHeap = cmdQ.getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 8192); @@ -233,14 +233,14 @@ HWTEST_F(HardwareCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoComme DebugManagerStateRestore dbgRestore; DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true); - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); auto kernelInfo = std::make_unique(); - std::unique_ptr kernel(new MockKernel(&program, *kernelInfo, *pDevice)); + std::unique_ptr kernel(new MockKernel(&program, *kernelInfo, *pClDevice)); auto &indirectHeap = cmdQ.getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 8192); indirectHeap.getSpace(128u); @@ -276,7 +276,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, sendIndirectStateResourceUsage using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); std::unique_ptr srcImage(Image2dHelper<>::create(pContext)); ASSERT_NE(nullptr, srcImage.get()); @@ -362,7 +362,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, sendIndirectStateResourceUsage HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelWithFourBindingTableEntriesWhenIndirectStateIsEmittedThenInterfaceDescriptorContainsCorrectBindingTableEntryCount) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); auto &commandStream = cmdQ.getCS(1024); auto pWalkerCmd = static_cast(commandStream.getSpace(sizeof(GPGPU_WALKER))); @@ -405,7 +405,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelWithFourBindingTabl HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelThatIsSchedulerWhenIndirectStateIsEmittedThenInterfaceDescriptorContainsZeroBindingTableEntryCount) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); auto &commandStream = cmdQ.getCS(1024); auto pWalkerCmd = static_cast(commandStream.getSpace(sizeof(GPGPU_WALKER))); @@ -446,7 +446,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelThatIsSchedulerWhen HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelWith100BindingTableEntriesWhenIndirectStateIsEmittedThenInterfaceDescriptorHas31BindingTableEntriesSet) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); auto &commandStream = cmdQ.getCS(1024); auto pWalkerCmd = static_cast(commandStream.getSpace(sizeof(GPGPU_WALKER))); @@ -490,7 +490,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, whenSendingIndirectStateThenKe using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); std::unique_ptr img(Image2dHelper<>::create(pContext)); @@ -570,7 +570,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, usedBindingTableStatePointer) typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE; using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - CommandQueueHw cmdQ(pContext, pDevice, 0); + CommandQueueHw cmdQ(pContext, pClDevice, 0); std::unique_ptr dstImage(Image2dHelper<>::create(pContext)); ASSERT_NE(nullptr, dstImage.get()); @@ -702,7 +702,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, usedBindingTableStatePointersF program.setConstantSurface(&gfxConstAlloc); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); SKernelBinaryHeaderCommon kernelHeader; @@ -756,7 +756,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, usedBindingTableStatePointersF // try with different offsets to surface state base address for (uint32_t ssbaOffset : {0U, (uint32_t)sizeof(typename FamilyType::RENDER_SURFACE_STATE)}) { - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); auto &commandStream = cmdQ.getCS(1024); auto pWalkerCmd = static_cast(commandStream.getSpace(sizeof(GPGPU_WALKER))); @@ -823,7 +823,7 @@ HWTEST_F(HardwareCommandsTest, setBindingTableStatesForKernelWithBuffersNotRequi MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[256]; @@ -848,7 +848,7 @@ HWTEST_F(HardwareCommandsTest, setBindingTableStatesForKernelWithBuffersNotRequi // initialize kernel ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); auto &ssh = cmdQ.getIndirectHeap(IndirectHeap::SURFACE_STATE, 8192); ssh.align(8); @@ -881,7 +881,7 @@ HWTEST_F(HardwareCommandsTest, setBindingTableStatesForNoSurfaces) { MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[256]; @@ -897,7 +897,7 @@ HWTEST_F(HardwareCommandsTest, setBindingTableStatesForNoSurfaces) { // initialize kernel ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); auto &ssh = cmdQ.getIndirectHeap(IndirectHeap::SURFACE_STATE, 8192); // Initialize binding table state pointers with pattern @@ -1013,7 +1013,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER; - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); const size_t localWorkSizes[3]{1, 1, 1}; auto &commandStream = cmdQ.getCS(1024); @@ -1281,7 +1281,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenCacheFlushAfterWalkerEnab DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); auto &commandStream = cmdQ.getCS(1024); MockGraphicsAllocation globalAllocation; @@ -1315,7 +1315,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenCacheFlushAfterWalkerEnab DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); auto &commandStream = cmdQ.getCS(1024); char buff[MemoryConstants::pageSize * 2]; @@ -1353,7 +1353,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenCacheFlushAfterWalkerEnab DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); auto &commandStream = cmdQ.getCS(1024); addSpaceForSingleKernelArg(); @@ -1384,7 +1384,7 @@ HWTEST_F(HardwareCommandsTest, givenCacheFlushAfterWalkerDisabledWhenGettingRequ DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(0); - CommandQueueHw cmdQ(nullptr, pDevice, 0); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); size_t expectedSize = 0U; size_t actualSize = HardwareCommandsHelper::getSizeRequiredForCacheFlush(cmdQ, mockKernelWithInternal->mockKernel, 0U); diff --git a/unit_tests/helpers/kmd_notify_tests.cpp b/unit_tests/helpers/kmd_notify_tests.cpp index 1a4efaa025..fa94cbb3da 100644 --- a/unit_tests/helpers/kmd_notify_tests.cpp +++ b/unit_tests/helpers/kmd_notify_tests.cpp @@ -24,7 +24,7 @@ using namespace NEO; struct KmdNotifyTests : public ::testing::Test { void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(nullptr)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); cmdQ.reset(new MockCommandQueue(&context, device.get(), nullptr)); *device->getDefaultEngine().commandStreamReceiver->getTagAddress() = taskCountToWait; @@ -90,7 +90,7 @@ struct KmdNotifyTests : public ::testing::Test { MockKmdNotifyHelper *mockKmdNotifyHelper = nullptr; HardwareInfo *hwInfo = nullptr; MockContext context; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr cmdQ; FlushStamp flushStampToWait = 1000; uint32_t taskCountToWait = 5; diff --git a/unit_tests/helpers/task_information_tests.cpp b/unit_tests/helpers/task_information_tests.cpp index ca0e540f79..2dd9fec30d 100644 --- a/unit_tests/helpers/task_information_tests.cpp +++ b/unit_tests/helpers/task_information_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,7 +21,7 @@ using namespace NEO; TEST(CommandTest, mapUnmapSubmitWithoutTerminateFlagFlushesCsr) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); std::unique_ptr cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); MockCommandStreamReceiver csr(*device->getExecutionEnvironment(), device->getRootDeviceIndex()); MockBuffer buffer; @@ -38,7 +38,7 @@ TEST(CommandTest, mapUnmapSubmitWithoutTerminateFlagFlushesCsr) { } TEST(CommandTest, mapUnmapSubmitWithTerminateFlagAbortsFlush) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); std::unique_ptr cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); MockCommandStreamReceiver csr(*device->getExecutionEnvironment(), device->getRootDeviceIndex()); MockBuffer buffer; @@ -58,7 +58,7 @@ TEST(CommandTest, mapUnmapSubmitWithTerminateFlagAbortsFlush) { } TEST(CommandTest, markerSubmitWithoutTerminateFlagDosntFlushCsr) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); std::unique_ptr cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); MockCommandStreamReceiver csr(*device->getExecutionEnvironment(), device->getRootDeviceIndex()); MockBuffer buffer; @@ -72,7 +72,7 @@ TEST(CommandTest, markerSubmitWithoutTerminateFlagDosntFlushCsr) { } TEST(CommandTest, markerSubmitWithTerminateFlagAbortsFlush) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); std::unique_ptr cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); MockCommandStreamReceiver csr(*device->getExecutionEnvironment(), device->getRootDeviceIndex()); MockBuffer buffer; @@ -96,7 +96,7 @@ TEST(CommandTest, givenWaitlistRequestWhenCommandComputeKernelIsCreatedThenMakeL : CommandComputeKernel(commandQueue, kernelOperation, surfaces, false, false, false, nullptr, PreemptionMode::Disabled, kernel, 0) {} }; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); CommandQueue cmdQ(nullptr, device.get(), nullptr); MockKernelWithInternals kernel(*device); @@ -128,7 +128,7 @@ TEST(CommandTest, givenWaitlistRequestWhenCommandComputeKernelIsCreatedThenMakeL } TEST(KernelOperationDestruction, givenKernelOperationWhenItIsDestructedThenAllAllocationsAreStoredInInternalStorageForReuse) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); CommandQueue cmdQ(nullptr, device.get(), nullptr); InternalAllocationStorage &allocationStorage = *device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(); auto &allocationsForReuse = allocationStorage.getAllocationsForReuse(); diff --git a/unit_tests/helpers/timestamp_packet_tests.cpp b/unit_tests/helpers/timestamp_packet_tests.cpp index 0629fcbde8..20129ee65d 100644 --- a/unit_tests/helpers/timestamp_packet_tests.cpp +++ b/unit_tests/helpers/timestamp_packet_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -50,7 +50,7 @@ struct TimestampPacketTests : public TimestampPacketSimpleTests { void SetUp() override { executionEnvironment = platformImpl->peekExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(2); - device = std::unique_ptr(Device::create(executionEnvironment, 0u)); + device = std::make_unique(Device::create(executionEnvironment, 0u)); context = new MockContext(device.get()); kernel = std::make_unique(*device, context); mockCmdQ = new MockCommandQueue(context, device.get(), nullptr); @@ -92,7 +92,7 @@ struct TimestampPacketTests : public TimestampPacketSimpleTests { } ExecutionEnvironment *executionEnvironment; - std::unique_ptr device; + std::unique_ptr device; MockContext *context; std::unique_ptr kernel; MockCommandQueue *mockCmdQ; @@ -636,7 +636,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe } HWTEST_F(TimestampPacketTests, givenEventsRequestWhenEstimatingStreamSizeForCsrThenAddSizeForSemaphores) { - auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); MockContext context2(device2.get()); auto cmdQ2 = std::make_unique>(&context2, device2.get(), nullptr); @@ -667,10 +667,10 @@ HWTEST_F(TimestampPacketTests, givenEventsRequestWhenEstimatingStreamSizeForCsrT EventsRequest eventsRequest(numEventsOnWaitlist, waitlist, nullptr); DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); - auto sizeWithoutEvents = csr.getRequiredCmdStreamSize(flags, *device); + auto sizeWithoutEvents = csr.getRequiredCmdStreamSize(flags, device->getDevice()); flags.csrDependencies.fillFromEventsRequest(eventsRequest, csr, NEO::CsrDependencies::DependenciesType::OutOfCsr); - auto sizeWithEvents = csr.getRequiredCmdStreamSize(flags, *device); + auto sizeWithEvents = csr.getRequiredCmdStreamSize(flags, device->getDevice()); size_t sizeForNodeDependency = 0; for (auto timestampPacketContainer : flags.csrDependencies) { @@ -715,10 +715,10 @@ HWTEST_F(TimestampPacketTests, givenEventsRequestWhenEstimatingStreamSizeForDiff EventsRequest eventsRequest(numEventsOnWaitlist, waitlist, nullptr); DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); - auto sizeWithoutEvents = csr.getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithoutEvents = csr.getRequiredCmdStreamSize(flags, device->getDevice()); flags.csrDependencies.fillFromEventsRequest(eventsRequest, csr, NEO::CsrDependencies::DependenciesType::OutOfCsr); - auto sizeWithEvents = csr.getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithEvents = csr.getRequiredCmdStreamSize(flags, device->getDevice()); size_t sizeForNodeDependency = 0; for (auto timestampPacketContainer : flags.csrDependencies) { @@ -736,7 +736,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(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; @@ -790,7 +790,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe } HWTEST_F(TimestampPacketTests, givenAllDependencyTypesModeWhenFillingFromDifferentCsrsThenPushEverything) { - auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); auto &csr1 = device->getUltCommandStreamReceiver(); auto &csr2 = device2->getUltCommandStreamReceiver(); @@ -877,7 +877,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(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; @@ -969,7 +969,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(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; MockContext context2(device2.get()); @@ -1321,7 +1321,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTim HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueueingThenMakeAllTimestampsResident) { TagAllocator tagAllocator(device->getRootDeviceIndex(), executionEnvironment->memoryManager.get(), 1, 1, sizeof(TimestampPacketStorage), false); - auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); auto &ultCsr = device->getUltCommandStreamReceiver(); ultCsr.timestampPacketWriteEnabled = true; @@ -1569,7 +1569,7 @@ HWTEST_F(TimestampPacketTests, givenBlockedEnqueueWithoutKernelWhenSubmittingThe HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingMarkerWithoutKernelThenInheritTimestampPacketsAndProgramSemaphores) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; @@ -1608,7 +1608,7 @@ HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingMarkerWi HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingBarrierWithoutKernelThenInheritTimestampPacketsAndProgramSemaphores) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); + auto device2 = std::make_unique(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; @@ -1710,10 +1710,10 @@ HWTEST_F(TimestampPacketTests, givenPipeControlRequestWhenEstimatingCsrStreamSiz DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); csr.stallingPipeControlOnNextFlushRequired = false; - auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, device->getDevice()); csr.stallingPipeControlOnNextFlushRequired = true; - auto sizeWithPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, device->getDevice()); size_t extendedSize = sizeWithoutPcRequest + sizeof(typename FamilyType::PIPE_CONTROL); @@ -1730,10 +1730,10 @@ HWTEST_F(TimestampPacketTests, givenPipeControlRequestWithBarrierWriteWhenEstima flags.barrierTimestampPacketNodes = &barrierTimestampPacketNode; csr.stallingPipeControlOnNextFlushRequired = false; - auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, device->getDevice()); csr.stallingPipeControlOnNextFlushRequired = true; - auto sizeWithPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, device->getDevice()); size_t extendedSize = sizeWithoutPcRequest + PipeControlHelper::getSizeForPipeControlWithPostSyncOperation(device->getHardwareInfo()); @@ -1745,10 +1745,10 @@ HWTEST_F(TimestampPacketTests, givenInstructionCacheRequesWhenSizeIsEstimatedThe DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); csr.requiresInstructionCacheFlush = false; - auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, device->getDevice()); csr.requiresInstructionCacheFlush = true; - auto sizeWithPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); + auto sizeWithPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, device->getDevice()); size_t extendedSize = sizeWithoutPcRequest + sizeof(typename FamilyType::PIPE_CONTROL); diff --git a/unit_tests/kernel/clone_kernel_tests.cpp b/unit_tests/kernel/clone_kernel_tests.cpp index ce189f0b50..ca63505f1c 100644 --- a/unit_tests/kernel/clone_kernel_tests.cpp +++ b/unit_tests/kernel/clone_kernel_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,7 +39,7 @@ class CloneKernelFixture : public ContextFixture, public DeviceFixture { protected: void SetUp() { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); // define kernel info @@ -82,12 +82,12 @@ class CloneKernelFixture : public ContextFixture, public DeviceFixture { pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pSourceKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pSourceKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pSourceKernel->initialize()); char pSourceCrossThreadData[64] = {}; pSourceKernel->setCrossThreadData(pSourceCrossThreadData, sizeof(pSourceCrossThreadData)); - pClonedKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pClonedKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pClonedKernel->initialize()); char pClonedCrossThreadData[64] = {}; pClonedKernel->setCrossThreadData(pClonedCrossThreadData, sizeof(pClonedCrossThreadData)); @@ -387,7 +387,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CloneKernelTest, cloneKernelWithArgDeviceQueue) { CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0, 0, 0}; - MockDeviceQueueHw mockDevQueue(pContext, pDevice, queueProps[0]); + MockDeviceQueueHw mockDevQueue(pContext, pClDevice, queueProps[0]); auto clDeviceQueue = static_cast(&mockDevQueue); pSourceKernel->setKernelArgHandler(0, &Kernel::setArgDevQueue); diff --git a/unit_tests/kernel/debug_kernel_tests.cpp b/unit_tests/kernel/debug_kernel_tests.cpp index 74830c01a1..c6684e0e73 100644 --- a/unit_tests/kernel/debug_kernel_tests.cpp +++ b/unit_tests/kernel/debug_kernel_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,37 +16,37 @@ using namespace NEO; TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) { - auto device = std::make_unique(); + auto device = std::make_unique(new MockDevice); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); - std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); + std::unique_ptr kernel(MockKernel::create(device->getDevice(), &program)); EXPECT_EQ(0, kernel->getDebugSurfaceBti()); } TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenCorrectValueIsReturned) { - auto device = std::make_unique(); + auto device = std::make_unique(new MockDevice); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); - std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); + std::unique_ptr kernel(MockKernel::create(device->getDevice(), &program)); EXPECT_EQ(MockDebugKernel::perThreadSystemThreadSurfaceSize, kernel->getPerThreadSystemThreadSurfaceSize()); } TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledThenInvalidIndexValueIsReturned) { - auto device = std::make_unique(); + auto device = std::make_unique(new MockDevice); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); - std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); + std::unique_ptr kernel(MockKernel::create(device->getDevice(), &program)); EXPECT_EQ(-1, kernel->getDebugSurfaceBti()); } TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenZeroIsReturned) { - auto device = std::make_unique(); + auto device = std::make_unique(new MockDevice); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); - std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); + std::unique_ptr kernel(MockKernel::create(device->getDevice(), &program)); EXPECT_EQ(0u, kernel->getPerThreadSystemThreadSurfaceSize()); } diff --git a/unit_tests/kernel/kernel_accelerator_arg_tests.cpp b/unit_tests/kernel/kernel_accelerator_arg_tests.cpp index 05fad384e8..7b5af5e07b 100644 --- a/unit_tests/kernel/kernel_accelerator_arg_tests.cpp +++ b/unit_tests/kernel/kernel_accelerator_arg_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -41,7 +41,7 @@ class KernelArgAcceleratorFixture : public ContextFixture, public DeviceFixture CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL}; DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); pKernelInfo = std::make_unique(); @@ -61,7 +61,7 @@ class KernelArgAcceleratorFixture : public ContextFixture, public DeviceFixture pKernelInfo->kernelArgInfo[0].offsetVmeSearchPathType = 0x1c; pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setKernelArgHandler(0, &Kernel::setArgAccelerator); diff --git a/unit_tests/kernel/kernel_arg_buffer_fixture.cpp b/unit_tests/kernel/kernel_arg_buffer_fixture.cpp index 86e5ec64e3..d59b87af19 100644 --- a/unit_tests/kernel/kernel_arg_buffer_fixture.cpp +++ b/unit_tests/kernel/kernel_arg_buffer_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,7 +26,7 @@ using namespace NEO; void KernelArgBufferFixture::SetUp() { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); // define kernel info @@ -49,7 +49,7 @@ void KernelArgBufferFixture::SetUp() { pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); diff --git a/unit_tests/kernel/kernel_arg_dev_queue_tests.cpp b/unit_tests/kernel/kernel_arg_dev_queue_tests.cpp index 0b8a995466..91f6aba9ec 100644 --- a/unit_tests/kernel/kernel_arg_dev_queue_tests.cpp +++ b/unit_tests/kernel/kernel_arg_dev_queue_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -37,7 +37,7 @@ struct KernelArgDevQueueTest : public DeviceFixture, pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector.push_back(kernelArgPatchInfo); program = std::make_unique(*pDevice->getExecutionEnvironment()); - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); uint8_t pCrossThreadData[crossThreadDataSize]; diff --git a/unit_tests/kernel/kernel_arg_info_tests.cpp b/unit_tests/kernel/kernel_arg_info_tests.cpp index d159fcbd9c..dd1211aa48 100644 --- a/unit_tests/kernel/kernel_arg_info_tests.cpp +++ b/unit_tests/kernel/kernel_arg_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,7 +31,7 @@ class KernelArgInfoTest : public ProgramFromSourceTest { ASSERT_NE(nullptr, pProgram); ASSERT_EQ(CL_SUCCESS, retVal); - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); retVal = pProgram->build( 1, &device, diff --git a/unit_tests/kernel/kernel_arg_pipe_tests.cpp b/unit_tests/kernel/kernel_arg_pipe_tests.cpp index c7a7dc6d34..ab6c14d93b 100644 --- a/unit_tests/kernel/kernel_arg_pipe_tests.cpp +++ b/unit_tests/kernel/kernel_arg_pipe_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -34,7 +34,7 @@ class KernelArgPipeFixture : public ContextFixture, public DeviceFixture { protected: void SetUp() { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); // define kernel info @@ -57,7 +57,7 @@ class KernelArgPipeFixture : public ContextFixture, public DeviceFixture { pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); diff --git a/unit_tests/kernel/kernel_arg_svm_tests.cpp b/unit_tests/kernel/kernel_arg_svm_tests.cpp index 731c53e840..ccaa977bff 100644 --- a/unit_tests/kernel/kernel_arg_svm_tests.cpp +++ b/unit_tests/kernel/kernel_arg_svm_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ class KernelArgSvmFixture_ : public ContextFixture, public DeviceFixture { protected: void SetUp() { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); // define kernel info @@ -56,7 +56,7 @@ class KernelArgSvmFixture_ : public ContextFixture, public DeviceFixture { pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); } @@ -270,7 +270,7 @@ HWTEST_F(KernelArgSvmTest, PatchWithImplicitSurface) { { void *addressToPatch = svmAlloc.getUnderlyingBuffer(); size_t sizeToPatch = svmAlloc.getUnderlyingBufferSize(); - Buffer::setSurfaceState(pDevice, &expectedSurfaceState, sizeToPatch, addressToPatch, &svmAlloc); + Buffer::setSurfaceState(pClDevice, &expectedSurfaceState, sizeToPatch, addressToPatch, &svmAlloc); } // verify ssh was properly patched @@ -376,7 +376,7 @@ HWTEST_TYPED_TEST(KernelArgSvmTestTyped, GivenBufferKernelArgWhenBufferOffsetIsN using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; constexpr size_t rendSurfSize = sizeof(RENDER_SURFACE_STATE); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); uint32_t svmSize = MemoryConstants::pageSize; char *svmPtr = reinterpret_cast(alignedMalloc(svmSize, MemoryConstants::pageSize)); diff --git a/unit_tests/kernel/kernel_cache_flush_requirements_tests.cpp b/unit_tests/kernel/kernel_cache_flush_requirements_tests.cpp index 66f6881abd..6386a40ef1 100644 --- a/unit_tests/kernel/kernel_cache_flush_requirements_tests.cpp +++ b/unit_tests/kernel/kernel_cache_flush_requirements_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,7 +17,7 @@ using namespace NEO; TEST(KernelWithCacheFlushTests, givenDeviceWhichDoesntRequireCacheFlushWhenCheckIfKernelRequireFlushThenReturnedFalse) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); auto mockKernel = std::make_unique(*device); MockContext mockContext(device.get()); diff --git a/unit_tests/kernel/kernel_immediate_arg_tests.cpp b/unit_tests/kernel/kernel_immediate_arg_tests.cpp index bf8fbf132f..ff54d2d562 100644 --- a/unit_tests/kernel/kernel_immediate_arg_tests.cpp +++ b/unit_tests/kernel/kernel_immediate_arg_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -57,7 +57,7 @@ class KernelArgImmediateTest : public Test { pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector[0].size = sizeof(T); program = std::make_unique(*pDevice->getExecutionEnvironment()); - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); diff --git a/unit_tests/kernel/kernel_is_patched_tests.cpp b/unit_tests/kernel/kernel_is_patched_tests.cpp index 4e2aadf01c..7f24011593 100644 --- a/unit_tests/kernel/kernel_is_patched_tests.cpp +++ b/unit_tests/kernel/kernel_is_patched_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,7 +16,7 @@ using namespace NEO; class PatchedKernelTest : public ::testing::Test { public: void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(nullptr)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); context.reset(new MockContext(device.get())); program.reset(Program::create("FillBufferBytes", context.get(), *device.get(), true, &retVal)); EXPECT_EQ(CL_SUCCESS, retVal); @@ -30,7 +30,7 @@ class PatchedKernelTest : public ::testing::Test { } std::unique_ptr context; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr program; std::unique_ptr kernel; cl_int retVal = CL_SUCCESS; diff --git a/unit_tests/kernel/kernel_reflection_surface_tests.cpp b/unit_tests/kernel/kernel_reflection_surface_tests.cpp index 6bce1c5cf6..3446c600b9 100644 --- a/unit_tests/kernel/kernel_reflection_surface_tests.cpp +++ b/unit_tests/kernel/kernel_reflection_surface_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -606,7 +606,7 @@ TEST_P(KernelReflectionSurfaceTest, getCurbeParamsReturnsTokenMask) { } TEST(KernelReflectionSurfaceTestSingle, CreateKernelReflectionSurfaceCalledOnNonParentKernelDoesNotCreateReflectionSurface) { - MockDevice device; + MockClDevice device{new MockDevice}; MockProgram program(*device.getExecutionEnvironment()); KernelInfo info; MockKernel kernel(&program, info, device); @@ -624,7 +624,7 @@ TEST(KernelReflectionSurfaceTestSingle, CreateKernelReflectionSurfaceCalledOnNon DebugManagerStateRestore dbgRestorer; DebugManager.flags.ForceDispatchScheduler.set(true); - MockDevice device; + MockClDevice device{new MockDevice}; MockProgram program(*device.getExecutionEnvironment()); KernelInfo info; MockKernel kernel(&program, info, device); @@ -640,7 +640,7 @@ TEST(KernelReflectionSurfaceTestSingle, CreateKernelReflectionSurfaceCalledOnNon TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithoutKernelArgs) { MockContext context; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockProgram program(*device->getExecutionEnvironment()); KernelInfo *blockInfo = new KernelInfo; KernelInfo &info = *blockInfo; @@ -691,7 +691,7 @@ TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithoutKern TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithDeviceQueueKernelArg) { MockContext context; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockProgram program(*device->getExecutionEnvironment()); KernelInfo *blockInfo = new KernelInfo; @@ -1958,7 +1958,7 @@ class ReflectionSurfaceConstantValuesPatchingTest : public DeviceFixture, TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryWhenReflectionSurfaceIsPatchedWithConstantValuesThenProgramGlobalMemoryAddressIsPatched) { - MockContext context(pDevice); + MockContext context(pClDevice); MockParentKernel *parentKernel = MockParentKernel::create(context, false, true, false); // graphicsMemory is released by Program @@ -1992,7 +1992,7 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryWh TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryAndProgramWithoutGlobalMemortWhenReflectionSurfaceIsPatchedWithConstantValuesThenZeroAddressIsPatched) { - MockContext context(pDevice); + MockContext context(pClDevice); MockParentKernel *parentKernel = MockParentKernel::create(context, false, true, false); if (parentKernel->mockProgram->getGlobalSurface()) { @@ -2025,7 +2025,7 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithGlobalMemoryAn TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemoryWhenReflectionSurfaceIsPatchedWithConstantValuesThenProgramConstantMemoryAddressIsPatched) { - MockContext context(pDevice); + MockContext context(pClDevice); MockParentKernel *parentKernel = MockParentKernel::create(context, false, false, true); // graphicsMemory is released by Program @@ -2068,7 +2068,7 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemory TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemoryAndProgramWithoutConstantMemortWhenReflectionSurfaceIsPatchedWithConstantValuesThenZeroAddressIsPatched) { - MockContext context(pDevice); + MockContext context(pClDevice); MockParentKernel *parentKernel = MockParentKernel::create(context, false, false, true); if (parentKernel->mockProgram->getConstantSurface()) { diff --git a/unit_tests/kernel/kernel_slm_arg_tests.cpp b/unit_tests/kernel/kernel_slm_arg_tests.cpp index 199d2d6445..97fc54dbcd 100644 --- a/unit_tests/kernel/kernel_slm_arg_tests.cpp +++ b/unit_tests/kernel/kernel_slm_arg_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,7 +39,7 @@ class KernelSlmArgTest : public Test { pKernelInfo->workloadInfo.slmStaticSize = 3 * KB; program = std::make_unique(*pDevice->getExecutionEnvironment()); - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setKernelArgHandler(0, &Kernel::setArgLocal); diff --git a/unit_tests/kernel/kernel_slm_tests.cpp b/unit_tests/kernel/kernel_slm_tests.cpp index 2c691c45d8..113846b216 100644 --- a/unit_tests/kernel/kernel_slm_tests.cpp +++ b/unit_tests/kernel/kernel_slm_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -67,15 +67,15 @@ struct KernelSLMAndBarrierTest : public DeviceFixture, static uint32_t slmSizeInKb[] = {1, 4, 8, 16, 32, 64}; HWCMDTEST_P(IGFX_GEN8_CORE, KernelSLMAndBarrierTest, test_SLMProgramming) { - ASSERT_NE(nullptr, pDevice); - CommandQueueHw cmdQ(nullptr, pDevice, 0); + ASSERT_NE(nullptr, pClDevice); + CommandQueueHw cmdQ(nullptr, pClDevice, 0); typedef typename FamilyType::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA; // define kernel info executionEnvironment.HasBarriers = 1; kernelInfo.workloadInfo.slmStaticSize = GetParam() * KB; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); // After creating Mock Kernel now create Indirect Heap diff --git a/unit_tests/kernel/kernel_tests.cpp b/unit_tests/kernel/kernel_tests.cpp index 0beee63316..5bed696347 100644 --- a/unit_tests/kernel/kernel_tests.cpp +++ b/unit_tests/kernel/kernel_tests.cpp @@ -55,7 +55,7 @@ class KernelTest : public ProgramFromBinaryTest { ASSERT_NE(nullptr, pProgram); ASSERT_EQ(CL_SUCCESS, retVal); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; retVal = pProgram->build( 1, &device, @@ -268,7 +268,7 @@ TEST_P(KernelTest, GetWorkGroupInfo_WorkgroupSize) { pKernel->maxKernelWorkGroupSize = static_cast(kernelMaxWorkGroupSize); retVal = pKernel->getWorkGroupInfo( - pDevice, + pClDevice, paramName, paramValueSize, ¶mValue, @@ -286,7 +286,7 @@ TEST_P(KernelTest, GetWorkGroupInfo_CompileWorkgroupSize) { size_t paramValueSizeRet = 0; retVal = pKernel->getWorkGroupInfo( - pDevice, + pClDevice, paramName, paramValueSize, ¶mValue, @@ -314,7 +314,7 @@ class KernelFromBinaryTest : public ProgramSimpleFixture { typedef Test KernelFromBinaryTests; TEST_F(KernelFromBinaryTests, getInfo_NumArgs) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "kernel_num_args"); @@ -357,7 +357,7 @@ TEST_F(KernelFromBinaryTests, getInfo_NumArgs) { } TEST_F(KernelFromBinaryTests, BuiltInIsSetToFalseForRegularKernels) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "simple_kernels"); @@ -392,7 +392,7 @@ TEST_F(KernelFromBinaryTests, BuiltInIsSetToFalseForRegularKernels) { } TEST_F(KernelFromBinaryTests, givenArgumentDeclaredAsConstantWhenKernelIsCreatedThenArgumentIsMarkedAsReadOnly) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "simple_kernels"); @@ -443,7 +443,7 @@ struct KernelWithDeviceQueueFixture : public DeviceFixture, public testing::Test { void SetUp() override { DeviceFixture::SetUp(); - DeviceQueueFixture::SetUp(&context, pDevice); + DeviceQueueFixture::SetUp(&context, pClDevice); } void TearDown() override { DeviceQueueFixture::TearDown(); @@ -545,7 +545,7 @@ TEST_F(KernelPrivateSurfaceTest, testPrivateSurface) { // create kernel MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); // Test it @@ -583,7 +583,7 @@ TEST_F(KernelPrivateSurfaceTest, givenKernelWithPrivateSurfaceThatIsInUseByGpuWh MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); pKernel->initialize(); auto &csr = pDevice->getGpgpuCommandStreamReceiver(); @@ -628,7 +628,7 @@ TEST_F(KernelPrivateSurfaceTest, testPrivateSurfaceAllocationFailure) { MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); MemoryManagementFixture::InjectedFunction method = [&](size_t failureIndex) { - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, pKernel->initialize()); @@ -672,7 +672,7 @@ TEST_F(KernelPrivateSurfaceTest, given32BitDeviceWhenKernelIsCreatedThenPrivateS // create kernel MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); @@ -706,7 +706,7 @@ HWTEST_F(KernelPrivateSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenPri MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[0x80]; @@ -757,7 +757,7 @@ TEST_F(KernelPrivateSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenPriv program.setConstantSurface(&gfxAlloc); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -798,7 +798,7 @@ TEST_F(KernelPrivateSurfaceTest, GivenKernelWhenPrivateSurfaceTooBigAndGpuPointe pKernelInfo->patchInfo.executionEnvironment = executionEnvironment.get(); MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); pKernelInfo->gpuPointerSize = 4; pDevice->getMemoryManager()->setForce32BitAllocations(false); if (pDevice->getDeviceInfo().computeUnitsUsedForScratch == 0) @@ -817,7 +817,7 @@ TEST_F(KernelPrivateSurfaceTest, GivenKernelWhenPrivateSurfaceTooBigAndGpuPointe pKernelInfo->patchInfo.executionEnvironment = executionEnvironment.get(); MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); pKernelInfo->gpuPointerSize = 4; pDevice->getMemoryManager()->setForce32BitAllocations(true); if (pDevice->getDeviceInfo().computeUnitsUsedForScratch == 0) @@ -836,7 +836,7 @@ TEST_F(KernelPrivateSurfaceTest, GivenKernelWhenPrivateSurfaceTooBigAndGpuPointe pKernelInfo->patchInfo.executionEnvironment = executionEnvironment.get(); MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); pKernelInfo->gpuPointerSize = 8; pDevice->getMemoryManager()->setForce32BitAllocations(true); if (pDevice->getDeviceInfo().computeUnitsUsedForScratch == 0) @@ -875,7 +875,7 @@ TEST_F(KernelGlobalSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenGlobalS MockContext context; MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); program.setGlobalSurface(&gfxAlloc); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); pKernel->isBuiltIn = true; @@ -917,7 +917,7 @@ TEST_F(KernelGlobalSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenGlobalS // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); program.setGlobalSurface(&gfxAlloc); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); @@ -956,7 +956,7 @@ HWTEST_F(KernelGlobalSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenGlob program.setGlobalSurface(&gfxAlloc); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[0x80]; @@ -1005,7 +1005,7 @@ TEST_F(KernelGlobalSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenGloba program.setGlobalSurface(&gfxAlloc); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1049,7 +1049,7 @@ TEST_F(KernelConstantSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenConst // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); program.setConstantSurface(&gfxAlloc); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); pKernel->isBuiltIn = true; @@ -1091,7 +1091,7 @@ TEST_F(KernelConstantSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenConst // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); program.setConstantSurface(&gfxAlloc); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); @@ -1130,7 +1130,7 @@ HWTEST_F(KernelConstantSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenCo program.setConstantSurface(&gfxAlloc); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[0x80]; @@ -1179,7 +1179,7 @@ TEST_F(KernelConstantSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenCon program.setConstantSurface(&gfxAlloc); // create kernel - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1214,7 +1214,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatefulKernelWhenK // create kernel MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[0x80]; @@ -1266,7 +1266,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatefulKernelWhenE // create kernel MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[0x80]; @@ -1312,7 +1312,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenKernelWithNullEvent // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1350,7 +1350,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatelessKernelWhen // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1386,7 +1386,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelEventPoolSurfaceTest, givenStatelessKernelWhen // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1424,7 +1424,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatefulKe // create kernel MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[0x80]; @@ -1476,7 +1476,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatefulKe // create kernel MockProgram program(*pDevice->getExecutionEnvironment(), &context, false); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // setup surface state heap char surfaceStateHeap[0x80]; @@ -1530,7 +1530,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatelessK // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1558,7 +1558,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenKernelWith // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1596,7 +1596,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelDefaultDeviceQueueSurfaceTest, givenStatelessK // create kernel MockProgram program(*pDevice->getExecutionEnvironment()); - MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); + MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pClDevice); // define stateful path pKernelInfo->usesSsh = false; @@ -1642,7 +1642,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenKernelIsaIs MockProgram program(*pDevice->getExecutionEnvironment()); MockContext ctx; program.setContext(&ctx); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); @@ -1667,7 +1667,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenExportedFun program.exportedFunctionsSurface = exportedFunctionsSurface.get(); MockContext ctx; program.setContext(&ctx); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); EXPECT_EQ(0u, commandStreamReceiver.makeResidentAllocations.size()); @@ -1704,7 +1704,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenGlobalBuffe MockContext ctx; program.setContext(&ctx); program.globalSurface = new MockGraphicsAllocation(); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); EXPECT_EQ(0u, commandStreamReceiver.makeResidentAllocations.size()); @@ -1729,7 +1729,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenGlobalBuffe } HWTEST_F(KernelResidencyTest, givenKernelWhenItUsesIndirectUnifiedMemoryDeviceAllocationThenTheyAreMadeResident) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1753,7 +1753,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenItUsesIndirectUnifiedMemoryDeviceAl } HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectHostMemoryWhenMakeResidentIsCalledThenOnlyHostAllocationsAreMadeResident) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1773,7 +1773,7 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectHostMemoryWhenMakeResident } HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryWhenMakeResidentIsCalledThenOnlySharedAllocationsAreMadeResident) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1795,7 +1795,7 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryWhenMakeReside HWTEST_F(KernelResidencyTest, givenDeviceUnifiedMemoryAndPageFaultManagerWhenMakeResidentIsCalledThenAllocationIsNotDecommited) { auto mockPageFaultManager = new MockPageFaultManager(); static_cast(this->pDevice->getExecutionEnvironment()->memoryManager.get())->pageFaultManager.reset(mockPageFaultManager); - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1821,7 +1821,7 @@ HWTEST_F(KernelResidencyTest, givenDeviceUnifiedMemoryAndPageFaultManagerWhenMak HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMakeResidentIsCalledThenAllocationIsDecommited) { auto mockPageFaultManager = new MockPageFaultManager(); static_cast(this->pDevice->getExecutionEnvironment()->memoryManager.get())->pageFaultManager.reset(mockPageFaultManager); - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1854,7 +1854,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenMakeResidentIsCalledThenAllocationIsNotDecommited) { auto mockPageFaultManager = new MockPageFaultManager(); static_cast(this->pDevice->getExecutionEnvironment()->memoryManager.get())->pageFaultManager.reset(mockPageFaultManager); - MockKernelWithInternals mockKernel(*this->pDevice, nullptr, true); + MockKernelWithInternals mockKernel(*this->pClDevice, nullptr, true); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1880,7 +1880,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenM HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAllocPageFaultManagerAndIndirectAllocsAllowedWhenMakeResidentIsCalledThenAllocationIsDecommited) { auto mockPageFaultManager = new MockPageFaultManager(); static_cast(this->pDevice->getExecutionEnvironment()->memoryManager.get())->pageFaultManager.reset(mockPageFaultManager); - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1907,7 +1907,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAllocPageFaultManagerAndIn } HWTEST_F(KernelResidencyTest, givenKernelWhenSetKernelExecInfoWithUnifiedMemoryIsCalledThenAllocationIsStoredWithinKernel) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); @@ -1931,7 +1931,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenSetKernelExecInfoWithUnifiedMemoryI } HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemoryIsCalledThenAllocationIsStoredWithinKernel) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY)); @@ -1954,7 +1954,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor } HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemoryDevicePropertyIsCalledThenKernelControlIsChanged) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); cl_bool enableIndirectDeviceAccess = CL_TRUE; auto status = clSetKernelExecInfo(mockKernel.mockKernel, CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL, sizeof(cl_bool), &enableIndirectDeviceAccess); EXPECT_EQ(CL_SUCCESS, status); @@ -1966,7 +1966,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor } HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemoryHostPropertyIsCalledThenKernelControlIsChanged) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); cl_bool enableIndirectHostAccess = CL_TRUE; auto status = clSetKernelExecInfo(mockKernel.mockKernel, CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL, sizeof(cl_bool), &enableIndirectHostAccess); EXPECT_EQ(CL_SUCCESS, status); @@ -1978,7 +1978,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor } HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemorySharedPropertyIsCalledThenKernelControlIsChanged) { - MockKernelWithInternals mockKernel(*this->pDevice); + MockKernelWithInternals mockKernel(*this->pClDevice); cl_bool enableIndirectSharedAccess = CL_TRUE; auto status = clSetKernelExecInfo(mockKernel.mockKernel, CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL, sizeof(cl_bool), &enableIndirectSharedAccess); EXPECT_EQ(CL_SUCCESS, status); @@ -1996,7 +1996,7 @@ TEST(KernelImageDetectionTests, givenKernelWithImagesOnlyWhenItIsAskedIfItHasIma pKernelInfo->kernelArgInfo[1].isMediaBlockImage = true; pKernelInfo->kernelArgInfo[0].isMediaImage = true; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device)); @@ -2012,7 +2012,7 @@ TEST(KernelImageDetectionTests, givenKernelWithImagesAndBuffersWhenItIsAskedIfIt pKernelInfo->kernelArgInfo[1].isBuffer = true; pKernelInfo->kernelArgInfo[0].isMediaImage = true; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device)); @@ -2026,7 +2026,7 @@ TEST(KernelImageDetectionTests, givenKernelWithNoImagesWhenItIsAskedIfItHasImage pKernelInfo->kernelArgInfo.resize(1); pKernelInfo->kernelArgInfo[0].isBuffer = true; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device)); @@ -2079,7 +2079,7 @@ HWTEST_F(KernelResidencyTest, test_MakeArgsResidentCheckImageFromImage) { auto program = std::make_unique(*pDevice->getExecutionEnvironment()); program->setContext(&context); - std::unique_ptr pKernel(new MockKernel(program.get(), *pKernelInfo, *pDevice)); + std::unique_ptr pKernel(new MockKernel(program.get(), *pKernelInfo, *pClDevice)); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->storeKernelArg(0, Kernel::IMAGE_OBJ, (cl_mem)imageY.get(), NULL, 0); @@ -2100,7 +2100,7 @@ struct KernelExecutionEnvironmentTest : public Test { pKernelInfo = std::make_unique(); pKernelInfo->patchInfo.executionEnvironment = &executionEnvironment; - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); } @@ -2256,7 +2256,7 @@ TEST_F(KernelCrossThreadTests, globalWorkOffset) { pKernelInfo->workloadInfo.globalWorkOffsetOffsets[1] = 4; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_EQ(&Kernel::dummyPatchLocation, kernel.globalWorkOffsetX); @@ -2269,7 +2269,7 @@ TEST_F(KernelCrossThreadTests, localWorkSize) { pKernelInfo->workloadInfo.localWorkSizeOffsets[0] = 0xc; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_NE(nullptr, kernel.localWorkSizeX); @@ -2282,7 +2282,7 @@ TEST_F(KernelCrossThreadTests, localWorkSize2) { pKernelInfo->workloadInfo.localWorkSizeOffsets2[1] = 0xd; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_EQ(&Kernel::dummyPatchLocation, kernel.localWorkSizeX2); @@ -2295,7 +2295,7 @@ TEST_F(KernelCrossThreadTests, globalWorkSize) { pKernelInfo->workloadInfo.globalWorkSizeOffsets[2] = 8; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_EQ(&Kernel::dummyPatchLocation, kernel.globalWorkSizeX); @@ -2308,7 +2308,7 @@ TEST_F(KernelCrossThreadTests, workDim) { pKernelInfo->workloadInfo.workDimOffset = 12; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_NE(nullptr, kernel.workDim); @@ -2321,7 +2321,7 @@ TEST_F(KernelCrossThreadTests, numWorkGroups) { pKernelInfo->workloadInfo.numWorkGroupsOffset[1] = 1 * sizeof(uint32_t); pKernelInfo->workloadInfo.numWorkGroupsOffset[2] = 2 * sizeof(uint32_t); - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_NE(nullptr, kernel.numWorkGroupsX); @@ -2336,7 +2336,7 @@ TEST_F(KernelCrossThreadTests, enqueuedLocalWorkSize) { pKernelInfo->workloadInfo.enqueuedLocalWorkSizeOffsets[0] = 0; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_NE(nullptr, kernel.enqueuedLocalWorkSizeX); @@ -2349,7 +2349,7 @@ TEST_F(KernelCrossThreadTests, maxWorkGroupSize) { pKernelInfo->workloadInfo.maxWorkGroupSizeOffset = 12; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_NE(nullptr, kernel.maxWorkGroupSizeForCrossThreadData); @@ -2362,7 +2362,7 @@ TEST_F(KernelCrossThreadTests, maxWorkGroupSize) { TEST_F(KernelCrossThreadTests, dataParameterSimdSize) { pKernelInfo->workloadInfo.simdSizeOffset = 16; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); executionEnvironment.CompiledSIMD32 = false; executionEnvironment.CompiledSIMD16 = false; executionEnvironment.CompiledSIMD8 = true; @@ -2376,7 +2376,7 @@ TEST_F(KernelCrossThreadTests, dataParameterSimdSize) { TEST_F(KernelCrossThreadTests, GIVENparentEventOffsetWHENinitializeKernelTHENparentEventInitWithInvalid) { pKernelInfo->workloadInfo.parentEventOffset = 16; - MockKernel kernel(program.get(), *pKernelInfo, *pDevice); + MockKernel kernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); EXPECT_NE(nullptr, kernel.parentEventOffset); @@ -2388,7 +2388,7 @@ TEST_F(KernelCrossThreadTests, GIVENparentEventOffsetWHENinitializeKernelTHENpar TEST_F(KernelCrossThreadTests, kernelAddRefCountToProgram) { auto refCount = program->getReference(); - MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); auto refCount2 = program->getReference(); EXPECT_EQ(refCount2, refCount + 1); @@ -2401,7 +2401,7 @@ TEST_F(KernelCrossThreadTests, kernelSetsTotalSLMSize) { pKernelInfo->workloadInfo.slmStaticSize = 1024; - MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); EXPECT_EQ(1024u, kernel->slmTotalSize); @@ -2415,7 +2415,7 @@ TEST_F(KernelCrossThreadTests, givenKernelWithPrivateMemoryWhenItIsCreatedThenCu allocatePrivate.PerThreadPrivateMemorySize = 1; pKernelInfo->patchInfo.pAllocateStatelessPrivateSurface = &allocatePrivate; - MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); kernel->initialize(); @@ -2434,7 +2434,7 @@ TEST_F(KernelCrossThreadTests, givenKernelWithPrivateMemoryWhenItIsCreatedThenCu TEST_F(KernelCrossThreadTests, givenKernelWithPreferredWkgMultipleWhenItIsCreatedThenCurbeIsPatchedProperly) { pKernelInfo->workloadInfo.preferredWkgMultipleOffset = 8; - MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + MockKernel *kernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); kernel->initialize(); @@ -2448,7 +2448,7 @@ TEST_F(KernelCrossThreadTests, givenKernelWithPreferredWkgMultipleWhenItIsCreate } TEST_F(KernelCrossThreadTests, patchBlocksSimdSize) { - MockKernelWithInternals *kernel = new MockKernelWithInternals(*pDevice); + MockKernelWithInternals *kernel = new MockKernelWithInternals(*pClDevice); // store offset to child's simd size in kernel info uint32_t crossThreadOffset = 0; //offset of simd size @@ -2510,7 +2510,7 @@ TEST(KernelInfoTest, getArgNumByName) { } TEST(KernelTest, getInstructionHeapSizeForExecutionModelReturnsZeroForNormalKernel) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); EXPECT_EQ(0u, kernel.mockKernel->getInstructionHeapSizeForExecutionModel()); @@ -2533,7 +2533,7 @@ TEST(KernelTest, setKernelArgUsesBuiltinDispatchInfoBuilderIfAvailable) { mutable std::vector> receivedArgs; }; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); kernel.kernelInfo.resizeKernelArgInfoAndRegisterParameter(1); kernel.mockKernel->initialize(); @@ -2594,7 +2594,7 @@ TEST(KernelTest, givenKernelWhenDebugFlagToUseMaxSimdForCalculationsIsUsedThenMa mySysInfo.EUCount = 24; mySysInfo.SubSliceCount = 3; mySysInfo.ThreadCount = 24 * 7; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&myHwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&myHwInfo)); MockKernelWithInternals kernel(*device); kernel.executionEnvironment.LargestCompiledSIMDSize = 32; @@ -2615,7 +2615,7 @@ TEST(KernelTest, givenKernelWithKernelInfoWith32bitPointerSizeThenReport32bit) { info.gpuPointerSize = 4; MockContext context; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment(), &context, false); std::unique_ptr kernel(new MockKernel(&program, info, *device.get())); @@ -2627,7 +2627,7 @@ TEST(KernelTest, givenKernelWithKernelInfoWith64bitPointerSizeThenReport64bit) { info.gpuPointerSize = 8; MockContext context; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment(), &context, false); std::unique_ptr kernel(new MockKernel(&program, info, *device.get())); @@ -2637,7 +2637,7 @@ TEST(KernelTest, givenKernelWithKernelInfoWith64bitPointerSizeThenReport64bit) { TEST(KernelTest, givenFtrRenderCompressedBuffersWhenInitializingArgsWithNonStatefulAccessThenMarkKernelForAuxTranslation) { DebugManagerStateRestore restore; DebugManager.flags.DisableAuxTranslation.set(false); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); auto &capabilityTable = hwInfo->capabilityTable; auto context = clUniquePtr(new MockContext(device.get())); @@ -2676,7 +2676,7 @@ TEST(KernelTest, givenDebugVariableSetWhenKernelHasStatefulBufferAccessThenMarkK HardwareInfo localHwInfo = *platformDevices[0]; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&localHwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&localHwInfo)); auto context = clUniquePtr(new MockContext(device.get())); MockKernelWithInternals kernel(*device, context.get()); kernel.kernelInfo.kernelArgInfo.resize(1); @@ -2698,7 +2698,7 @@ TEST(KernelTest, givenDebugVariableSetWhenKernelHasStatefulBufferAccessThenMarkK TEST(KernelTest, givenKernelWithPairArgumentWhenItIsInitializedThenPatchImmediateIsUsedAsArgHandler) { HardwareInfo localHwInfo = *platformDevices[0]; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&localHwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&localHwInfo)); auto context = clUniquePtr(new MockContext(device.get())); MockKernelWithInternals kernel(*device, context.get()); kernel.kernelInfo.kernelArgInfo.resize(1); @@ -2709,7 +2709,7 @@ TEST(KernelTest, givenKernelWithPairArgumentWhenItIsInitializedThenPatchImmediat } TEST(KernelTest, whenNullAllocationThenAssignNullPointerToCacheFlushVector) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); kernel.mockKernel->kernelArgRequiresCacheFlush.resize(1); kernel.mockKernel->kernelArgRequiresCacheFlush[0] = reinterpret_cast(0x1); @@ -2720,7 +2720,7 @@ TEST(KernelTest, whenNullAllocationThenAssignNullPointerToCacheFlushVector) { TEST(KernelTest, whenAllocationRequiringCacheFlushThenAssignAllocationPointerToCacheFlushVector) { MockGraphicsAllocation mockAllocation; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); kernel.mockKernel->kernelArgRequiresCacheFlush.resize(1); @@ -2733,7 +2733,7 @@ TEST(KernelTest, whenAllocationRequiringCacheFlushThenAssignAllocationPointerToC TEST(KernelTest, whenKernelRequireCacheFlushAfterWalkerThenRequireCacheFlushAfterWalker) { MockGraphicsAllocation mockAllocation; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); kernel.mockKernel->svmAllocationsRequireCacheFlush = true; @@ -2751,7 +2751,7 @@ TEST(KernelTest, whenKernelRequireCacheFlushAfterWalkerThenRequireCacheFlushAfte TEST(KernelTest, whenAllocationWriteableThenDoNotAssignAllocationPointerToCacheFlushVector) { MockGraphicsAllocation mockAllocation; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); kernel.mockKernel->kernelArgRequiresCacheFlush.resize(1); @@ -2764,7 +2764,7 @@ TEST(KernelTest, whenAllocationWriteableThenDoNotAssignAllocationPointerToCacheF TEST(KernelTest, whenAllocationReadOnlyNonFlushRequiredThenAssignNullPointerToCacheFlushVector) { MockGraphicsAllocation mockAllocation; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); kernel.mockKernel->kernelArgRequiresCacheFlush.resize(1); kernel.mockKernel->kernelArgRequiresCacheFlush[0] = reinterpret_cast(0x1); @@ -2777,7 +2777,7 @@ TEST(KernelTest, whenAllocationReadOnlyNonFlushRequiredThenAssignNullPointerToCa } TEST(KernelTest, givenKernelUsesPrivateMemoryWhenDeviceReleasedBeforeKernelThenKernelUsesMemoryManagerFromEnvironment) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); auto executionEnvironment = device->getExecutionEnvironment(); auto mockKernel = std::make_unique(*device); @@ -2791,7 +2791,7 @@ TEST(KernelTest, givenKernelUsesPrivateMemoryWhenDeviceReleasedBeforeKernelThenK } TEST(KernelTest, givenAllArgumentsAreStatefulBuffersWhenInitializingThenAllBufferArgsStatefulIsTrue) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); std::vector kernelArgInfo(2); kernelArgInfo[0].isBuffer = true; @@ -2807,7 +2807,7 @@ TEST(KernelTest, givenAllArgumentsAreStatefulBuffersWhenInitializingThenAllBuffe } TEST(KernelTest, givenAllArgumentsAreBuffersButNotAllAreStatefulWhenInitializingThenAllBufferArgsStatefulIsFalse) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); std::vector kernelArgInfo(2); kernelArgInfo[0].isBuffer = true; @@ -2823,7 +2823,7 @@ TEST(KernelTest, givenAllArgumentsAreBuffersButNotAllAreStatefulWhenInitializing } TEST(KernelTest, givenNotAllArgumentsAreBuffersButAllBuffersAreStatefulWhenInitializingThenAllBufferArgsStatefulIsTrue) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); std::vector kernelArgInfo(2); kernelArgInfo[0].isBuffer = true; @@ -2839,7 +2839,7 @@ TEST(KernelTest, givenNotAllArgumentsAreBuffersButAllBuffersAreStatefulWhenIniti } TEST(KernelTest, givenKernelRequiringPrivateScratchSpaceWhenGettingSizeForPrivateScratchSpaceThenCorrectSizeIsReturned) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals mockKernel(*device); SPatchMediaVFEState mediaVFEstate; @@ -2853,7 +2853,7 @@ TEST(KernelTest, givenKernelRequiringPrivateScratchSpaceWhenGettingSizeForPrivat } TEST(KernelTest, givenKernelWithoutMediaVfeStateSlot1WhenGettingSizeForPrivateScratchSpaceThenCorrectSizeIsReturned) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals mockKernel(*device); mockKernel.kernelInfo.patchInfo.mediaVfeStateSlot1 = nullptr; @@ -2865,7 +2865,7 @@ TEST(KernelTest, givenKernelWithPatchInfoCollectionEnabledWhenPatchWithImplicitS DebugManagerStateRestore restore; DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); MockGraphicsAllocation mockAllocation; SPatchAllocateStatelessGlobalMemorySurfaceWithInitialization patchToken{}; @@ -2876,7 +2876,7 @@ TEST(KernelTest, givenKernelWithPatchInfoCollectionEnabledWhenPatchWithImplicitS } TEST(KernelTest, givenKernelWithPatchInfoCollectionDisabledWhenPatchWithImplicitSurfaceCalledThenPatchInfoDataIsNotCollected) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); MockGraphicsAllocation mockAllocation; SPatchAllocateStatelessGlobalMemorySurfaceWithInitialization patchToken{}; @@ -2887,13 +2887,13 @@ TEST(KernelTest, givenKernelWithPatchInfoCollectionDisabledWhenPatchWithImplicit } TEST(KernelTest, givenDefaultKernelWhenItIsCreatedThenItReportsStatelessWrites) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); EXPECT_TRUE(kernel.mockKernel->areStatelessWritesUsed()); } TEST(KernelTest, givenPolicyWhensetKernelThreadArbitrationPolicyThenExpectedClValueIsReturned) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); EXPECT_EQ(CL_SUCCESS, kernel.mockKernel->setKernelThreadArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL)); EXPECT_EQ(CL_SUCCESS, kernel.mockKernel->setKernelThreadArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_OLDEST_FIRST_INTEL)); @@ -2919,7 +2919,7 @@ class DeviceQueueHwMock : public DeviceQueueHw { using BaseClass::getWaCommandsSize; using BaseClass::offsetDsh; - DeviceQueueHwMock(Context *context, Device *device, cl_queue_properties &properties) : BaseClass(context, device, properties) { + DeviceQueueHwMock(Context *context, ClDevice *device, cl_queue_properties &properties) : BaseClass(context, device, properties) { auto slb = this->getSlbBuffer(); LinearStream *slbCS = getSlbCS(); slbCS->replaceBuffer(slb->getUnderlyingBuffer(), slb->getUnderlyingBufferSize()); // reset diff --git a/unit_tests/kernel/parent_kernel_tests.cpp b/unit_tests/kernel/parent_kernel_tests.cpp index d0523fdf0c..1c24fc19a4 100644 --- a/unit_tests/kernel/parent_kernel_tests.cpp +++ b/unit_tests/kernel/parent_kernel_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,7 +26,7 @@ class MockKernelWithArgumentAccess : public Kernel { class ObjectCountsPublic : public Kernel::ObjectCounts { }; - MockKernelWithArgumentAccess(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg) { + MockKernelWithArgumentAccess(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg) { } void getParentObjectCountsPublic(MockKernelWithArgumentAccess::ObjectCountsPublic &objectCount) { @@ -36,9 +36,8 @@ class MockKernelWithArgumentAccess : public Kernel { TEST(ParentKernelTest, GetObjectCounts) { KernelInfo info; - MockDevice *device = new MockDevice; + MockClDevice *device = new MockClDevice{new MockDevice}; MockProgram program(*device->getExecutionEnvironment()); - SPatchExecutionEnvironment environment = {}; environment.HasDeviceEnqueue = 1; @@ -65,7 +64,7 @@ TEST(ParentKernelTest, GetObjectCounts) { } TEST(ParentKernelTest, patchBlocksSimdSize) { - MockDevice device; + MockClDevice device{new MockDevice}; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context, true)); MockProgram *program = (MockProgram *)parentKernel->mockProgram; @@ -79,7 +78,7 @@ TEST(ParentKernelTest, patchBlocksSimdSize) { } TEST(ParentKernelTest, hasDeviceEnqueue) { - MockDevice device; + MockClDevice device{new MockDevice}; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context)); @@ -87,14 +86,14 @@ TEST(ParentKernelTest, hasDeviceEnqueue) { } TEST(ParentKernelTest, doesnthaveDeviceEnqueue) { - MockDevice device; + MockClDevice device{new MockDevice}; MockKernelWithInternals kernel(device); EXPECT_FALSE(kernel.kernelInfo.hasDeviceEnqueue()); } TEST(ParentKernelTest, initializeOnParentKernelPatchesBlocksSimdSize) { - MockDevice device; + MockClDevice device{new MockDevice}; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context, true)); MockProgram *program = (MockProgram *)parentKernel->mockProgram; @@ -108,7 +107,7 @@ TEST(ParentKernelTest, initializeOnParentKernelPatchesBlocksSimdSize) { } TEST(ParentKernelTest, initializeOnParentKernelAllocatesPrivateMemoryForBlocks) { - MockDevice device; + MockClDevice device{new MockDevice}; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context, true)); MockProgram *program = (MockProgram *)parentKernel->mockProgram; diff --git a/unit_tests/kernel/substitute_kernel_heap_tests.cpp b/unit_tests/kernel/substitute_kernel_heap_tests.cpp index c44e2ea7e6..11182ccc62 100644 --- a/unit_tests/kernel/substitute_kernel_heap_tests.cpp +++ b/unit_tests/kernel/substitute_kernel_heap_tests.cpp @@ -16,7 +16,7 @@ using namespace NEO; typedef Test KernelSubstituteTest; TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithGreaterSizeThenAllocatesNewKernelAllocation) { - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); auto pHeader = const_cast(kernel.kernelInfo.heapInfo.pKernelHeader); const size_t initialHeapSize = 0x40; pHeader->KernelHeapSize = initialHeapSize; @@ -47,7 +47,7 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithGreaterSizeT } TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSameSizeThenDoesNotAllocateNewKernelAllocation) { - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); auto pHeader = const_cast(kernel.kernelInfo.heapInfo.pKernelHeader); const size_t initialHeapSize = 0x40; pHeader->KernelHeapSize = initialHeapSize; @@ -77,7 +77,7 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSameSizeThen } TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSmallerSizeThenDoesNotAllocateNewKernelAllocation) { - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); auto pHeader = const_cast(kernel.kernelInfo.heapInfo.pKernelHeader); const size_t initialHeapSize = 0x40; pHeader->KernelHeapSize = initialHeapSize; @@ -107,7 +107,7 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSmallerSizeT } TEST_F(KernelSubstituteTest, givenKernelWithUsedKernelAllocationWhenSubstituteKernelHeapAndAllocateNewMemoryThenStoreOldAllocationOnTemporaryList) { - MockKernelWithInternals kernel(*pDevice); + MockKernelWithInternals kernel(*pClDevice); auto pHeader = const_cast(kernel.kernelInfo.heapInfo.pKernelHeader); auto memoryManager = pDevice->getMemoryManager(); auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); diff --git a/unit_tests/mem_obj/buffer_set_arg_tests.cpp b/unit_tests/mem_obj/buffer_set_arg_tests.cpp index 3eef13da3c..7821df4876 100644 --- a/unit_tests/mem_obj/buffer_set_arg_tests.cpp +++ b/unit_tests/mem_obj/buffer_set_arg_tests.cpp @@ -38,7 +38,7 @@ class BufferSetArgTest : public ContextFixture, protected: void SetUp() override { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); pKernelInfo = std::make_unique(); ASSERT_NE(nullptr, pKernelInfo); @@ -69,7 +69,7 @@ class BufferSetArgTest : public ContextFixture, pProgram = new MockProgram(*pDevice->getExecutionEnvironment(), pContext, false); - pKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice); + pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice); ASSERT_NE(nullptr, pKernel); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData)); @@ -78,7 +78,7 @@ class BufferSetArgTest : public ContextFixture, pKernel->setKernelArgHandler(2, &Kernel::setArgBuffer); pKernel->setKernelArgHandler(0, &Kernel::setArgBuffer); - BufferDefaults::context = new MockContext(pDevice); + BufferDefaults::context = new MockContext(pClDevice); buffer = BufferHelper<>::create(BufferDefaults::context); } diff --git a/unit_tests/mem_obj/buffer_tests.cpp b/unit_tests/mem_obj/buffer_tests.cpp index b0a35489b0..b49ace4fbe 100644 --- a/unit_tests/mem_obj/buffer_tests.cpp +++ b/unit_tests/mem_obj/buffer_tests.cpp @@ -124,7 +124,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithReadOnlyFlagsThenB memset(memory, 0xAA, MemoryConstants::pageSize); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); ::testing::NiceMock *memoryManager = new ::testing::NiceMock(*device->getExecutionEnvironment()); device->injectMemoryManager(memoryManager); @@ -154,7 +154,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithReadOnlyFlagsAndSe memset(memory, 0xAA, MemoryConstants::pageSize); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); ::testing::NiceMock *memoryManager = new ::testing::NiceMock(*device->getExecutionEnvironment()); device->injectMemoryManager(memoryManager); @@ -180,7 +180,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithKernelWriteFlagThe memset(memory, 0xAA, MemoryConstants::pageSize); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); ::testing::NiceMock *memoryManager = new ::testing::NiceMock(*device->getExecutionEnvironment()); device->injectMemoryManager(memoryManager); @@ -200,7 +200,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithKernelWriteFlagThe } TEST(Buffer, givenNullPtrWhenBufferIsCreatedWithKernelReadOnlyFlagsThenBufferAllocationFailsAndReturnsNullptr) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); ::testing::NiceMock *memoryManager = new ::testing::NiceMock(*device->getExecutionEnvironment()); device->injectMemoryManager(memoryManager); @@ -219,7 +219,7 @@ TEST(Buffer, givenNullPtrWhenBufferIsCreatedWithKernelReadOnlyFlagsThenBufferAll } TEST(Buffer, givenNullptrPassedToBufferCreateWhenAllocationIsNotSystemMemoryPoolThenBufferIsNotZeroCopy) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); ::testing::NiceMock *memoryManager = new ::testing::NiceMock(*device->getExecutionEnvironment()); device->injectMemoryManager(memoryManager); @@ -238,7 +238,7 @@ TEST(Buffer, givenNullptrPassedToBufferCreateWhenAllocationIsNotSystemMemoryPool } TEST(Buffer, givenNullptrPassedToBufferCreateWhenAllocationIsNotSystemMemoryPoolThenAllocationIsNotAddedToHostPtrManager) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); ::testing::NiceMock *memoryManager = new ::testing::NiceMock(*device->getExecutionEnvironment()); device->injectMemoryManager(memoryManager); @@ -261,7 +261,7 @@ TEST(Buffer, givenNullptrPassedToBufferCreateWhenAllocationIsNotSystemMemoryPool } TEST(Buffer, givenNullptrPassedToBufferCreateWhenNoSharedContextOrRenderCompressedBuffersThenBuffersAllocationTypeIsBufferOrBufferHostMemory) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext ctx(device.get()); cl_int retVal = 0; @@ -278,7 +278,7 @@ TEST(Buffer, givenNullptrPassedToBufferCreateWhenNoSharedContextOrRenderCompress } TEST(Buffer, givenHostPtrPassedToBufferCreateWhenMemUseHostPtrFlagisSetAndBufferIsNotZeroCopyThenCreateMapAllocationWithHostPtr) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext ctx(device.get()); cl_int retVal = 0; @@ -300,7 +300,7 @@ TEST(Buffer, givenHostPtrPassedToBufferCreateWhenMemUseHostPtrFlagisSetAndBuffer } TEST(Buffer, givenAlignedHostPtrPassedToBufferCreateWhenNoSharedContextOrRenderCompressedBuffersThenBuffersAllocationTypeIsBufferHostMemory) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext ctx(device.get()); cl_int retVal = 0; @@ -314,7 +314,7 @@ TEST(Buffer, givenAlignedHostPtrPassedToBufferCreateWhenNoSharedContextOrRenderC } TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRenderCompressedBuffersThenBuffersAllocationTypeIsBufferHostMemory) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext ctx(device.get()); cl_int retVal = 0; @@ -449,7 +449,7 @@ TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInS EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) .WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool)); - std::unique_ptr device(MockDevice::create(executionEnvironment, 0)); + auto device = std::make_unique(MockDevice::create(executionEnvironment, 0)); MockContext ctx(device.get()); EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) @@ -470,14 +470,14 @@ struct RenderCompressedBuffersTests : public ::testing::Test { void SetUp() override { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); hwInfo = executionEnvironment->getMutableHardwareInfo(); - device.reset(Device::create(executionEnvironment, 0u)); + device = std::make_unique(MockDevice::create(executionEnvironment, 0u)); context = std::make_unique(device.get(), true); context->contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; } cl_int retVal = CL_SUCCESS; HardwareInfo *hwInfo = nullptr; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr buffer; @@ -648,7 +648,7 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenRenderCompressedBufferWh struct BcsBufferTests : public ::testing::Test { class BcsMockContext : public MockContext { public: - BcsMockContext(Device *device) : MockContext(device) { + BcsMockContext(ClDevice *device) : MockContext(device) { bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex())); bcsCsr->setupContext(*bcsOsContext); @@ -706,7 +706,7 @@ struct BcsBufferTests : public ::testing::Test { } DebugManager.flags.EnableTimestampPacket.set(1); DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.set(1); - device.reset(MockDevice::createWithNewExecutionEnvironment(nullptr)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto &capabilityTable = device->getExecutionEnvironment()->getMutableHardwareInfo()->capabilityTable; bool createBcsEngine = !capabilityTable.blitterOperationsSupported; capabilityTable.blitterOperationsSupported = true; @@ -728,7 +728,7 @@ struct BcsBufferTests : public ::testing::Test { DebugManagerStateRestore restore; std::unique_ptr bcsOsContext; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr bcsMockContext; std::unique_ptr commandQueue; uint32_t hostPtr = 0; @@ -1333,7 +1333,7 @@ class BufferTest : public DeviceFixture, void SetUp() override { flags = GetParam(); DeviceFixture::SetUp(); - context.reset(new MockContext(pDevice)); + context.reset(new MockContext(pClDevice)); } void TearDown() override { @@ -1486,6 +1486,7 @@ struct ValidHostPtr void TearDown() override { delete buffer; BaseClass::TearDown(); + platformImpl.reset(); MemoryManagementFixture::TearDown(); } @@ -1830,11 +1831,11 @@ TEST(SharedBuffersTest, whenBuffersIsCreatedWithSharingHandlerThenItIsSharedBuff class BufferTests : public ::testing::Test { protected: void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); } void TearDown() override { } - std::unique_ptr device; + std::unique_ptr device; }; typedef BufferTests BufferSetSurfaceTests; @@ -2334,8 +2335,8 @@ struct BufferUnmapTest : public DeviceFixture, public ::testing::Test { }; HWTEST_F(BufferUnmapTest, givenBufferWithSharingHandlerWhenUnmappingThenUseEnqueueWriteBuffer) { - MockContext context(pDevice); - MockCommandQueueHw cmdQ(&context, pDevice, nullptr); + MockContext context(pClDevice); + MockCommandQueueHw cmdQ(&context, pClDevice, nullptr); auto retVal = CL_SUCCESS; std::unique_ptr buffer(Buffer::create(&context, CL_MEM_ALLOC_HOST_PTR, 123, nullptr, retVal)); @@ -2356,8 +2357,8 @@ HWTEST_F(BufferUnmapTest, givenBufferWithSharingHandlerWhenUnmappingThenUseEnque } HWTEST_F(BufferUnmapTest, givenBufferWithoutSharingHandlerWhenUnmappingThenDontUseEnqueueWriteBuffer) { - MockContext context(pDevice); - MockCommandQueueHw cmdQ(&context, pDevice, nullptr); + MockContext context(pClDevice); + MockCommandQueueHw cmdQ(&context, pClDevice, nullptr); auto retVal = CL_SUCCESS; std::unique_ptr buffer(Buffer::create(&context, CL_MEM_ALLOC_HOST_PTR, 123, nullptr, retVal)); @@ -2377,7 +2378,7 @@ HWTEST_F(BufferUnmapTest, givenBufferWithoutSharingHandlerWhenUnmappingThenDontU using BufferTransferTests = BufferUnmapTest; TEST_F(BufferTransferTests, givenBufferWhenTransferToHostPtrCalledThenCopyRequestedSizeAndOffsetOnly) { - MockContext context(pDevice); + MockContext context(pClDevice); auto retVal = CL_SUCCESS; const size_t bufferSize = 100; size_t ignoredParam = 123; @@ -2400,7 +2401,7 @@ TEST_F(BufferTransferTests, givenBufferWhenTransferToHostPtrCalledThenCopyReques } TEST_F(BufferTransferTests, givenBufferWhenTransferFromHostPtrCalledThenCopyRequestedSizeAndOffsetOnly) { - MockContext context(pDevice); + MockContext context(pClDevice); auto retVal = CL_SUCCESS; const size_t bufferSize = 100; size_t ignoredParam = 123; diff --git a/unit_tests/mem_obj/destructor_callback_tests.cpp b/unit_tests/mem_obj/destructor_callback_tests.cpp index 3f850e5f33..d2abf26aa5 100644 --- a/unit_tests/mem_obj/destructor_callback_tests.cpp +++ b/unit_tests/mem_obj/destructor_callback_tests.cpp @@ -1,10 +1,11 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "runtime/platform/platform.h" #include "test.h" #include "unit_tests/fixtures/buffer_fixture.h" #include "unit_tests/fixtures/memory_management_fixture.h" @@ -25,6 +26,7 @@ class DestructorCallbackFixture : public MemoryManagementFixture { void TearDown() override { delete BufferDefaults::context; + platformImpl.reset(); MemoryManagementFixture::TearDown(); } diff --git a/unit_tests/mem_obj/get_mem_object_info_tests.cpp b/unit_tests/mem_obj/get_mem_object_info_tests.cpp index bf1d631c76..d7e942059f 100644 --- a/unit_tests/mem_obj/get_mem_object_info_tests.cpp +++ b/unit_tests/mem_obj/get_mem_object_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -321,7 +321,7 @@ class GetMemObjectInfoLocalMemory : public GetMemObjectInfo { GetMemObjectInfo::SetUp(); delete BufferDefaults::context; - BufferDefaults::context = new MockContext(pDevice, true); + BufferDefaults::context = new MockContext(pClDevice, true); } std::unique_ptr dbgRestore; diff --git a/unit_tests/mem_obj/image1d_tests.cpp b/unit_tests/mem_obj/image1d_tests.cpp index 3f02803042..7f3fac7ac7 100644 --- a/unit_tests/mem_obj/image1d_tests.cpp +++ b/unit_tests/mem_obj/image1d_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -46,7 +46,7 @@ class CreateImage1DTest : public DeviceFixture, if (types == CL_MEM_OBJECT_IMAGE1D_ARRAY) { imageDesc.image_array_size = 10; } - context = new MockContext(pDevice); + context = new MockContext(pClDevice); if (types == CL_MEM_OBJECT_IMAGE1D_BUFFER) { imageDesc.mem_object = clCreateBuffer(context, CL_MEM_ALLOC_HOST_PTR, testImageDimensions, nullptr, nullptr); diff --git a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp index 50f8a510fe..3f23be69a1 100644 --- a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp +++ b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp @@ -218,7 +218,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndTooLargeRowPitchSpeci } TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlignmentWhenValidatingSurfaceFormatThenReturnError) { - static_cast(context.getDevice(0))->deviceInfo.imagePitchAlignment = 128; + static_cast(&context.getDevice(0)->getDevice())->deviceInfo.imagePitchAlignment = 128; imageDesc.image_width = 64; imageDesc.image_height = castToObject(imageDesc.mem_object)->getSize() / imageDesc.image_width; cl_mem_flags flags = CL_MEM_READ_ONLY; diff --git a/unit_tests/mem_obj/image2d_tests.cpp b/unit_tests/mem_obj/image2d_tests.cpp index 3ca041e8b0..b8894036e5 100644 --- a/unit_tests/mem_obj/image2d_tests.cpp +++ b/unit_tests/mem_obj/image2d_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -46,7 +46,7 @@ class CreateImage2DTest : public DeviceFixture, if (types == CL_MEM_OBJECT_IMAGE2D_ARRAY) { imageDesc.image_array_size = 10; } - context = new MockContext(pDevice); + context = new MockContext(pClDevice); } void TearDown() override { diff --git a/unit_tests/mem_obj/image3d_tests.cpp b/unit_tests/mem_obj/image3d_tests.cpp index 300e81e9b2..e4f2a7d9f9 100644 --- a/unit_tests/mem_obj/image3d_tests.cpp +++ b/unit_tests/mem_obj/image3d_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,7 +26,7 @@ class CreateImage3DTest : public DeviceFixture, protected: void SetUp() override { DeviceFixture::SetUp(); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); // clang-format off imageFormat.image_channel_data_type = CL_UNORM_INT8; diff --git a/unit_tests/mem_obj/image_array_size_tests.cpp b/unit_tests/mem_obj/image_array_size_tests.cpp index 95393b0852..283f55f42a 100644 --- a/unit_tests/mem_obj/image_array_size_tests.cpp +++ b/unit_tests/mem_obj/image_array_size_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -44,7 +44,7 @@ class ImageArraySizeTest : public DeviceFixture, imageDesc.mem_object = NULL; // clang-format on - context = new MockContext(pDevice); + context = new MockContext(pClDevice); if (types == CL_MEM_OBJECT_IMAGE1D_BUFFER) { imageDesc.mem_object = clCreateBuffer(context, CL_MEM_ALLOC_HOST_PTR, testImageDimensions, nullptr, nullptr); diff --git a/unit_tests/mem_obj/image_compression_fixture.h b/unit_tests/mem_obj/image_compression_fixture.h index 8a9b67d801..f754155fb8 100644 --- a/unit_tests/mem_obj/image_compression_fixture.h +++ b/unit_tests/mem_obj/image_compression_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -29,13 +29,13 @@ class ImageCompressionTests : public ::testing::Test { }; void SetUp() override { - mockDevice.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); myMemoryManager = new MyMemoryManager(*mockDevice->getExecutionEnvironment()); mockDevice->injectMemoryManager(myMemoryManager); mockContext = make_releaseable(mockDevice.get()); } - std::unique_ptr mockDevice; + std::unique_ptr mockDevice; ReleaseableObjectPtr mockContext; MyMemoryManager *myMemoryManager = nullptr; diff --git a/unit_tests/mem_obj/image_release_mapped_ptr_tests.cpp b/unit_tests/mem_obj/image_release_mapped_ptr_tests.cpp index 946d3c13ce..54908b24fe 100644 --- a/unit_tests/mem_obj/image_release_mapped_ptr_tests.cpp +++ b/unit_tests/mem_obj/image_release_mapped_ptr_tests.cpp @@ -21,7 +21,7 @@ template class MyMockCommandQueue : public CommandQueueHw { public: - MyMockCommandQueue(Context *context, Device *device) : CommandQueueHw(context, device, nullptr){}; + MyMockCommandQueue(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr){}; cl_int enqueueWriteImage(Image *dstImage, cl_bool blockingWrite, const size_t *origin, const size_t *region, @@ -48,11 +48,11 @@ class MyMockCommandQueue : public CommandQueueHw { class ImageUnmapTest : public ::testing::Test { public: void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context = std::make_unique(device.get()); image.reset(ImageHelper>::create(context.get())); } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr image; }; @@ -88,7 +88,7 @@ HWTEST_F(ImageUnmapTest, givenImageWhenEnqueueMapImageIsCalledTwiceThenAllocated cl_int retVal; size_t origin[] = {0, 0, 0}; size_t region[] = {1, 1, 1}; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); std::unique_ptr commandQueue(CommandQueue::create(context.get(), device.get(), nullptr, retVal)); commandQueue->enqueueMapImage(image.get(), CL_FALSE, 0, origin, region, nullptr, nullptr, 0, nullptr, nullptr, retVal); EXPECT_NE(nullptr, image->getAllocatedMapPtr()); diff --git a/unit_tests/mem_obj/image_set_arg_tests.cpp b/unit_tests/mem_obj/image_set_arg_tests.cpp index 31b3385a3b..c0e14a2d20 100644 --- a/unit_tests/mem_obj/image_set_arg_tests.cpp +++ b/unit_tests/mem_obj/image_set_arg_tests.cpp @@ -82,13 +82,13 @@ class ImageSetArgTest : public DeviceFixture, pKernelInfo->kernelArgInfo[0].isImage = true; program = std::make_unique(*pDevice->getExecutionEnvironment()); - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_NE(nullptr, pKernel); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setKernelArgHandler(0, &Kernel::setArgImage); pKernel->setKernelArgHandler(1, &Kernel::setArgImage); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); srcImage = Image3dHelper<>::create(context); ASSERT_NE(nullptr, srcImage); @@ -932,13 +932,13 @@ class ImageMediaBlockSetArgTest : public ImageSetArgTest { pKernelInfo->kernelArgInfo[0].isMediaBlockImage = true; program = std::make_unique(*pDevice->getExecutionEnvironment()); - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_NE(nullptr, pKernel); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); pKernel->setKernelArgHandler(0, &Kernel::setArgImage); pKernel->setKernelArgHandler(1, &Kernel::setArgImage); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); srcImage = Image3dHelper<>::create(context); ASSERT_NE(nullptr, srcImage); } diff --git a/unit_tests/mem_obj/image_tests.cpp b/unit_tests/mem_obj/image_tests.cpp index bfa176caa9..fac6e3f341 100644 --- a/unit_tests/mem_obj/image_tests.cpp +++ b/unit_tests/mem_obj/image_tests.cpp @@ -51,7 +51,7 @@ class CreateImageTest : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(pDevice, 0); + CommandQueueFixture::SetUp(pClDevice, 0); flags = GetParam(); // clang-format off @@ -525,6 +525,7 @@ struct CreateImageHostPtr void TearDown() override { delete image; BaseClass::TearDown(); + platformImpl.reset(); MemoryManagementFixture::TearDown(); } @@ -546,8 +547,6 @@ struct CreateImageHostPtr }; TEST_P(CreateImageHostPtr, isResidentDefaultsToFalseAfterCreate) { - KernelBinaryHelper kbHelper(KernelBinaryHelper::BUILT_INS); - image = createImage(retVal); ASSERT_NE(nullptr, image); @@ -1182,7 +1181,7 @@ TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotI EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) .WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool)); - std::unique_ptr device(MockDevice::create(executionEnvironment, 0)); + auto device = std::make_unique(MockDevice::create(executionEnvironment, 0)); MockContext ctx(device.get()); EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) @@ -1477,4 +1476,4 @@ TEST_F(ImageMultiRootDeviceTests, imageAllocationHasCorrectRootDeviceIndex) { auto graphicsAllocation = image->getGraphicsAllocation(); ASSERT_NE(nullptr, graphicsAllocation); EXPECT_EQ(expectedRootDeviceIndex, graphicsAllocation->getRootDeviceIndex()); -} \ No newline at end of file +} diff --git a/unit_tests/mem_obj/image_tiled_tests.cpp b/unit_tests/mem_obj/image_tiled_tests.cpp index 1a7646f72c..88f1b38e0b 100644 --- a/unit_tests/mem_obj/image_tiled_tests.cpp +++ b/unit_tests/mem_obj/image_tiled_tests.cpp @@ -35,7 +35,7 @@ class CreateTiledImageTest : public DeviceFixture, protected: void SetUp() override { DeviceFixture::SetUp(); - CommandQueueFixture::SetUp(pDevice, 0); + CommandQueueFixture::SetUp(pClDevice, 0); type = GetParam(); // clang-format off diff --git a/unit_tests/mem_obj/image_transfer_tests.cpp b/unit_tests/mem_obj/image_transfer_tests.cpp index afb77a4f81..26460f62a8 100644 --- a/unit_tests/mem_obj/image_transfer_tests.cpp +++ b/unit_tests/mem_obj/image_transfer_tests.cpp @@ -18,7 +18,7 @@ class ImageHostPtrTransferTests : public testing::Test { public: void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); context.reset(new MockContext(device.get())); } @@ -51,7 +51,7 @@ class ImageHostPtrTransferTests : public testing::Test { } } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr image; diff --git a/unit_tests/mem_obj/image_validate_tests.cpp b/unit_tests/mem_obj/image_validate_tests.cpp index 2e974e833b..9dadfe8d1a 100644 --- a/unit_tests/mem_obj/image_validate_tests.cpp +++ b/unit_tests/mem_obj/image_validate_tests.cpp @@ -69,15 +69,15 @@ TEST_P(ValidDescriptor, given3dImageFormatWhenGetSupportedFormatIsCalledThenDont uint32_t writeOnlyformatCount; uint32_t readWriteOnlyformatCount; - context.getSupportedImageFormats(context.getDevice(0), CL_MEM_READ_ONLY, imageDesc.image_type, 0, nullptr, &readOnlyformatCount); - context.getSupportedImageFormats(context.getDevice(0), CL_MEM_WRITE_ONLY, imageDesc.image_type, 0, nullptr, &writeOnlyformatCount); - context.getSupportedImageFormats(context.getDevice(0), CL_MEM_READ_WRITE, imageDesc.image_type, 0, nullptr, &readWriteOnlyformatCount); + context.getSupportedImageFormats(&context.getDevice(0)->getDevice(), CL_MEM_READ_ONLY, imageDesc.image_type, 0, nullptr, &readOnlyformatCount); + context.getSupportedImageFormats(&context.getDevice(0)->getDevice(), CL_MEM_WRITE_ONLY, imageDesc.image_type, 0, nullptr, &writeOnlyformatCount); + context.getSupportedImageFormats(&context.getDevice(0)->getDevice(), CL_MEM_READ_WRITE, imageDesc.image_type, 0, nullptr, &readWriteOnlyformatCount); auto readOnlyImgFormats = new cl_image_format[readOnlyformatCount]; auto writeOnlyImgFormats = new cl_image_format[writeOnlyformatCount]; auto readWriteOnlyImgFormats = new cl_image_format[readWriteOnlyformatCount]; - context.getSupportedImageFormats(context.getDevice(0), CL_MEM_READ_ONLY, imageDesc.image_type, readOnlyformatCount, readOnlyImgFormats, 0); - context.getSupportedImageFormats(context.getDevice(0), CL_MEM_WRITE_ONLY, imageDesc.image_type, writeOnlyformatCount, writeOnlyImgFormats, 0); - context.getSupportedImageFormats(context.getDevice(0), CL_MEM_READ_WRITE, imageDesc.image_type, readWriteOnlyformatCount, readWriteOnlyImgFormats, 0); + context.getSupportedImageFormats(&context.getDevice(0)->getDevice(), CL_MEM_READ_ONLY, imageDesc.image_type, readOnlyformatCount, readOnlyImgFormats, 0); + context.getSupportedImageFormats(&context.getDevice(0)->getDevice(), CL_MEM_WRITE_ONLY, imageDesc.image_type, writeOnlyformatCount, writeOnlyImgFormats, 0); + context.getSupportedImageFormats(&context.getDevice(0)->getDevice(), CL_MEM_READ_WRITE, imageDesc.image_type, readWriteOnlyformatCount, readWriteOnlyImgFormats, 0); bool depthFound = false; for (uint32_t i = 0; i < readOnlyformatCount; i++) { diff --git a/unit_tests/mem_obj/mem_obj_destruction_tests.cpp b/unit_tests/mem_obj/mem_obj_destruction_tests.cpp index 727d02cc30..1c627247cc 100644 --- a/unit_tests/mem_obj/mem_obj_destruction_tests.cpp +++ b/unit_tests/mem_obj/mem_obj_destruction_tests.cpp @@ -34,7 +34,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam { executionEnvironment = platformImpl->peekExecutionEnvironment(); memoryManager = new MockMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - device.reset(MockDevice::create(executionEnvironment, 0)); + device = std::make_unique(MockDevice::create(executionEnvironment, 0)); context.reset(new MockContext(device.get())); allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{size}); @@ -67,7 +67,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam { constexpr static uint32_t taskCountReady = 3u; ExecutionEnvironment *executionEnvironment = nullptr; - std::unique_ptr device; + std::unique_ptr device; uint32_t contextId = 0; MockMemoryManager *memoryManager = nullptr; std::unique_ptr context; diff --git a/unit_tests/mem_obj/mem_obj_tests.cpp b/unit_tests/mem_obj/mem_obj_tests.cpp index 30e326f6fe..b1d56862d0 100644 --- a/unit_tests/mem_obj/mem_obj_tests.cpp +++ b/unit_tests/mem_obj/mem_obj_tests.cpp @@ -169,7 +169,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAllocationIsNotAddedToMemoryManagerAllocationList) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - auto device = std::unique_ptr(MockDevice::create(executionEnvironment, 0)); + auto device = std::make_unique(MockDevice::create(executionEnvironment, 0)); MockContext context(device.get()); auto memoryManager = executionEnvironment->memoryManager.get(); @@ -505,4 +505,4 @@ TEST_F(MemObjMultiRootDeviceTests, memObjMapAllocationHasCorrectRootDeviceIndex) auto mapAllocation = memObj.getMapAllocation(); ASSERT_NE(nullptr, mapAllocation); EXPECT_EQ(expectedRootDeviceIndex, mapAllocation->getRootDeviceIndex()); -} \ No newline at end of file +} diff --git a/unit_tests/mem_obj/nv12_image_tests.cpp b/unit_tests/mem_obj/nv12_image_tests.cpp index 186cd12adb..f6d3e36e6d 100644 --- a/unit_tests/mem_obj/nv12_image_tests.cpp +++ b/unit_tests/mem_obj/nv12_image_tests.cpp @@ -379,7 +379,7 @@ TEST_F(Nv12ImageTest, createNV12UVPlaneImageWithOffsetOfUVPlane) { HWTEST_F(Nv12ImageTest, checkIfPlanesAreWritten) { KernelBinaryHelper kbHelper(KernelBinaryHelper::BUILT_INS); - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); char hostPtr[16 * 16 * 16]; diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 07bf6e8d07..877d764037 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -475,13 +475,13 @@ TEST_F(MemoryAllocatorTest, givenAllocationWithoutFragmentsWhenCallingFreeGraphi class MockPrintfHandler : public PrintfHandler { public: - static MockPrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, Device &deviceArg) { + static MockPrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &deviceArg) { return (MockPrintfHandler *)PrintfHandler::create(multiDispatchInfo, deviceArg); } }; TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithBaseAddressOffset) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); SPatchAllocateStatelessPrintfSurface printfSurface; @@ -499,7 +499,7 @@ TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCre kernel.kernelInfo.usesSsh = false; kernel.kernelInfo.requiresSshForBuffers = false; - auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device); + auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device.get()); printfHandler->prepareDispatch(multiDispatchInfo); @@ -517,7 +517,7 @@ TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCre } HWTEST_F(MemoryAllocatorTest, givenStatefulKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithCpuAddress) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); SPatchAllocateStatelessPrintfSurface printfSurface; @@ -535,7 +535,7 @@ HWTEST_F(MemoryAllocatorTest, givenStatefulKernelWithPrintfWhenPrintfSurfaceIsCr kernel.kernelInfo.usesSsh = true; kernel.kernelInfo.requiresSshForBuffers = true; - auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device); + auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device.get()); printfHandler->prepareDispatch(multiDispatchInfo); @@ -559,7 +559,7 @@ TEST_F(MemoryAllocatorTest, given32BitDeviceWhenPrintfSurfaceIsCreatedThen32BitA DebugManagerStateRestore dbgRestorer; if (is64bit) { DebugManager.flags.Force32bitAddressing.set(true); - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); MockKernelWithInternals kernel(*device); MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); SPatchAllocateStatelessPrintfSurface printfSurface; @@ -573,7 +573,7 @@ TEST_F(MemoryAllocatorTest, given32BitDeviceWhenPrintfSurfaceIsCreatedThen32BitA kernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &printfSurface; - auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device); + auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device.get()); for (int i = 0; i < 8; i++) { kernel.mockKernel->mockCrossThreadData[i] = 50; @@ -2115,7 +2115,7 @@ class MemoryManagerWithFailure : public MockMemoryManager { }; TEST(MemoryManagerTest, whenMemoryManagerReturnsNullptrThenAllocateGlobalsSurfaceAlsoReturnsNullptr) { - MockDevice device; + MockClDevice device{new MockDevice}; std::unique_ptr memoryManager(new MemoryManagerWithFailure()); device.injectMemoryManager(memoryManager.release()); MockContext context(&device, true); diff --git a/unit_tests/mocks/mock_buffer.h b/unit_tests/mocks/mock_buffer.h index 728ff9b5da..f04d05586b 100644 --- a/unit_tests/mocks/mock_buffer.h +++ b/unit_tests/mocks/mock_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,7 +23,7 @@ class MockBufferStorage { } char data[128]; MockGraphicsAllocation mockGfxAllocation; - std::unique_ptr device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + std::unique_ptr device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); }; class MockBuffer : public MockBufferStorage, public Buffer { diff --git a/unit_tests/mocks/mock_command_queue.h b/unit_tests/mocks/mock_command_queue.h index fb459b44a9..5f11d935bb 100644 --- a/unit_tests/mocks/mock_command_queue.h +++ b/unit_tests/mocks/mock_command_queue.h @@ -32,7 +32,7 @@ class MockCommandQueue : public CommandQueue { } MockCommandQueue() : CommandQueue(nullptr, nullptr, 0) {} MockCommandQueue(Context &context) : MockCommandQueue(&context, context.getDevice(0), nullptr) {} - MockCommandQueue(Context *context, Device *device, const cl_queue_properties *props) + MockCommandQueue(Context *context, ClDevice *device, const cl_queue_properties *props) : CommandQueue(context, device, props) { } @@ -84,7 +84,7 @@ class MockCommandQueueHw : public CommandQueueHw { using BaseClass::timestampPacketContainer; MockCommandQueueHw(Context *context, - Device *device, + ClDevice *device, cl_queue_properties *properties) : BaseClass(context, device, properties) { } diff --git a/unit_tests/mocks/mock_context.cpp b/unit_tests/mocks/mock_context.cpp index f367935569..240807fefa 100644 --- a/unit_tests/mocks/mock_context.cpp +++ b/unit_tests/mocks/mock_context.cpp @@ -20,7 +20,7 @@ namespace NEO { -MockContext::MockContext(Device *device, bool noSpecialQueue) { +MockContext::MockContext(ClDevice *device, bool noSpecialQueue) { memoryManager = device->getMemoryManager(); devices.push_back(device); svmAllocsManager = new SVMAllocsManager(memoryManager); @@ -59,7 +59,7 @@ MockContext::~MockContext() { } MockContext::MockContext() { - device = MockDevice::createWithNewExecutionEnvironment(nullptr); + device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; devices.push_back(device); memoryManager = device->getMemoryManager(); svmAllocsManager = new SVMAllocsManager(memoryManager); diff --git a/unit_tests/mocks/mock_context.h b/unit_tests/mocks/mock_context.h index cd93b4de2e..577a803288 100644 --- a/unit_tests/mocks/mock_context.h +++ b/unit_tests/mocks/mock_context.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,7 +20,7 @@ class MockContext : public Context { using Context::preferD3dSharedResources; using Context::sharingFunctions; using Context::svmAllocsManager; - MockContext(Device *device, bool noSpecialQueue = false); + MockContext(ClDevice *device, bool noSpecialQueue = false); MockContext( void(CL_CALLBACK *funcNotify)(const char *, const void *, size_t, void *), void *data); @@ -34,6 +34,6 @@ class MockContext : public Context { void registerSharingWithId(SharingFunctions *sharing, SharingType sharingId); private: - Device *device; + ClDevice *device; }; } // namespace NEO diff --git a/unit_tests/mocks/mock_device.cpp b/unit_tests/mocks/mock_device.cpp index 93fd50db73..29426eeec2 100644 --- a/unit_tests/mocks/mock_device.cpp +++ b/unit_tests/mocks/mock_device.cpp @@ -17,8 +17,24 @@ using namespace NEO; bool MockDevice::createSingleDevice = true; +bool &MockClDevice::createSingleDevice = MockDevice::createSingleDevice; + decltype(&createCommandStream) MockSubDevice::createCommandStreamReceiverFunc = createCommandStream; decltype(&createCommandStream) MockDevice::createCommandStreamReceiverFunc = createCommandStream; +decltype(&createCommandStream) &MockClDevice::createCommandStreamReceiverFunc = MockDevice::createCommandStreamReceiverFunc; + +MockClDevice::MockClDevice(MockDevice *pMockDevice) + : ClDevice(*pMockDevice), device(*pMockDevice), deviceInfo(pMockDevice->deviceInfo), + executionEnvironment(pMockDevice->executionEnvironment), + callBaseInitializeRootCommandStreamReceiver(pMockDevice->callBaseInitializeRootCommandStreamReceiver), + initializeRootCommandStreamReceiverReturnValue(pMockDevice->initializeRootCommandStreamReceiverReturnValue), + subdevices(pMockDevice->subdevices), mockMemoryManager(pMockDevice->mockMemoryManager), engines(pMockDevice->engines) { + + platform()->clDeviceMap.emplace(pMockDevice, this); + for (uint32_t i = 0; i < getNumAvailableDevices(); i++) { + platform()->clDeviceMap.emplace(pMockDevice->getDeviceById(i), this->getDeviceById(i)); + } +} MockDevice::MockDevice() : MockDevice(new MockExecutionEnvironment(), 0u) { @@ -31,6 +47,15 @@ MockDevice::MockDevice() initializeCaps(); } +MockClDevice::~MockClDevice() { + if (platform()) { + platform()->clDeviceMap.erase(&device); + for (uint32_t i = 0; i < getNumAvailableDevices(); i++) { + platform()->clDeviceMap.erase(device.getDeviceById(i)); + } + } +} + const char *MockDevice::getProductAbbrev() const { return hardwarePrefix[getHardwareInfo().platform.eProductFamily]; } diff --git a/unit_tests/mocks/mock_device.h b/unit_tests/mocks/mock_device.h index 5946a93981..8858dada0b 100644 --- a/unit_tests/mocks/mock_device.h +++ b/unit_tests/mocks/mock_device.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -34,13 +34,13 @@ class MockDevice : public RootDevice { using Device::commandStreamReceivers; using Device::createDeviceInternals; using Device::createEngine; + using Device::deviceExtensions; using Device::deviceInfo; using Device::enabledClVersion; using Device::engines; using Device::executionEnvironment; using Device::initializeCaps; using Device::name; - using Device::simultaneousInterops; using RootDevice::createEngines; using RootDevice::subdevices; @@ -128,6 +128,56 @@ class MockDevice : public RootDevice { std::unique_ptr mockMemoryManager; }; +class MockClDevice : public ClDevice { + public: + using ClDevice::ClDevice; + using ClDevice::simultaneousInterops; + + explicit MockClDevice(MockDevice *pMockDevice); + ~MockClDevice(); + + bool createEngines() { return device.createEngines(); } + void setOSTime(OSTime *osTime) { device.setOSTime(osTime); } + void setDriverInfo(DriverInfo *driverInfo) { device.setDriverInfo(driverInfo); } + bool hasDriverInfo() { return device.hasDriverInfo(); } + bool createDeviceImpl() { return device.createDeviceImpl(); } + bool getCpuTime(uint64_t *timeStamp) { return device.getCpuTime(timeStamp); } + void setPreemptionMode(PreemptionMode mode) { device.setPreemptionMode(mode); } + void injectMemoryManager(MemoryManager *pMemoryManager) { device.injectMemoryManager(pMemoryManager); } + void setPerfCounters(PerformanceCounters *perfCounters) { device.setPerfCounters(perfCounters); } + const char *getProductAbbrev() const { return device.getProductAbbrev(); } + template + UltCommandStreamReceiver &getUltCommandStreamReceiver() { return device.getUltCommandStreamReceiver(); } + template + UltCommandStreamReceiver &getUltCommandStreamReceiverFromIndex(uint32_t index) { return device.getUltCommandStreamReceiverFromIndex(index); } + CommandStreamReceiver &getGpgpuCommandStreamReceiver() const { return device.getGpgpuCommandStreamReceiver(); } + void resetCommandStreamReceiver(CommandStreamReceiver *newCsr) { device.resetCommandStreamReceiver(newCsr); } + void resetCommandStreamReceiver(CommandStreamReceiver *newCsr, uint32_t engineIndex) { device.resetCommandStreamReceiver(newCsr, engineIndex); } + void setSourceLevelDebuggerActive(bool active) { device.setSourceLevelDebuggerActive(active); } + template + static T *createWithExecutionEnvironment(const HardwareInfo *pHwInfo, ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) { + return MockDevice::createWithExecutionEnvironment(pHwInfo, executionEnvironment, rootDeviceIndex); + } + template + static T *createWithNewExecutionEnvironment(const HardwareInfo *pHwInfo, uint32_t rootDeviceIndex = 0) { + return MockDevice::createWithNewExecutionEnvironment(pHwInfo, rootDeviceIndex); + } + bool initializeRootCommandStreamReceiver() { return device.initializeRootCommandStreamReceiver(); } + SubDevice *createSubDevice(uint32_t subDeviceIndex) { return device.createSubDevice(subDeviceIndex); } + std::unique_ptr createCommandStreamReceiver() const { return device.createCommandStreamReceiver(); } + + MockDevice &device; + DeviceInfo &deviceInfo; + ExecutionEnvironment *&executionEnvironment; + static bool &createSingleDevice; + static decltype(&createCommandStream) &createCommandStreamReceiverFunc; + bool &callBaseInitializeRootCommandStreamReceiver; + bool &initializeRootCommandStreamReceiverReturnValue; + std::vector &subdevices; + std::unique_ptr &mockMemoryManager; + std::vector &engines; +}; + template <> inline Device *MockDevice::createWithNewExecutionEnvironment(const HardwareInfo *pHwInfo, uint32_t rootDeviceIndex) { auto executionEnvironment = new ExecutionEnvironment(); diff --git a/unit_tests/mocks/mock_device_queue.h b/unit_tests/mocks/mock_device_queue.h index b361aaab6d..d4e81e1dd8 100644 --- a/unit_tests/mocks/mock_device_queue.h +++ b/unit_tests/mocks/mock_device_queue.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -63,7 +63,7 @@ class MockDeviceQueueHw : public DeviceQueueHw { } expectedCmds; MockDeviceQueueHw(Context *context, - Device *device, + ClDevice *device, cl_queue_properties &properties) : BaseClass(context, device, properties) { auto slb = this->getSlbBuffer(); LinearStream *slbCS = getSlbCS(); diff --git a/unit_tests/mocks/mock_kernel.h b/unit_tests/mocks/mock_kernel.h index 284de150ec..9d1e962ea9 100644 --- a/unit_tests/mocks/mock_kernel.h +++ b/unit_tests/mocks/mock_kernel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,6 +11,7 @@ #include "core/kernel/grf_config.h" #include "runtime/device/device.h" #include "runtime/kernel/kernel.h" +#include "runtime/platform/platform.h" #include "runtime/program/block_kernel_manager.h" #include "runtime/scheduler/scheduler_kernel.h" #include "unit_tests/mocks/mock_context.h" @@ -87,7 +88,7 @@ class MockKernel : public Kernel { } }; - MockKernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg, bool scheduler = false) + MockKernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg, bool scheduler = false) : Kernel(programArg, kernelInfoArg, deviceArg, scheduler) { } @@ -114,6 +115,7 @@ class MockKernel : public Kernel { static KernelType *create(Device &device, Program *program, uint32_t grfNumber) { auto info = new KernelInfo(); const size_t crossThreadSize = 160; + auto pClDevice = platform()->clDeviceMap[&device]; SKernelBinaryHeaderCommon *header = new SKernelBinaryHeaderCommon; header->DynamicStateHeapSize = 0; @@ -141,7 +143,7 @@ class MockKernel : public Kernel { info->crossThreadData = new char[crossThreadSize]; - auto kernel = new KernelType(program, *info, device); + auto kernel = new KernelType(program, *info, *pClDevice); kernel->crossThreadData = new char[crossThreadSize]; memset(kernel->crossThreadData, 0, crossThreadSize); kernel->crossThreadDataSize = crossThreadSize; @@ -257,7 +259,7 @@ class MockKernel : public Kernel { //class below have enough internals to service Enqueue operation. class MockKernelWithInternals { public: - MockKernelWithInternals(const Device &deviceArg, Context *context = nullptr, bool addDefaultArg = false, SPatchExecutionEnvironment newExecutionEnvironment = {}) { + MockKernelWithInternals(const ClDevice &deviceArg, Context *context = nullptr, bool addDefaultArg = false, SPatchExecutionEnvironment newExecutionEnvironment = {}) { memset(&kernelHeader, 0, sizeof(SKernelBinaryHeaderCommon)); memset(&threadPayload, 0, sizeof(SPatchThreadPayload)); memcpy(&executionEnvironment, &newExecutionEnvironment, sizeof(SPatchExecutionEnvironment)); @@ -320,7 +322,7 @@ class MockKernelWithInternals { } } - MockKernelWithInternals(const Device &deviceArg, SPatchExecutionEnvironment newExecutionEnvironment) : MockKernelWithInternals(deviceArg, nullptr, false, newExecutionEnvironment) { + MockKernelWithInternals(const ClDevice &deviceArg, SPatchExecutionEnvironment newExecutionEnvironment) : MockKernelWithInternals(deviceArg, nullptr, false, newExecutionEnvironment) { mockKernel->initialize(); } @@ -357,7 +359,7 @@ class MockParentKernel : public Kernel { using Kernel::auxTranslationRequired; using Kernel::patchBlocksCurbeWithConstantValues; static MockParentKernel *create(Context &context, bool addChildSimdSize = false, bool addChildGlobalMemory = false, bool addChildConstantMemory = false, bool addPrintfForParent = true, bool addPrintfForBlock = true) { - Device &device = *context.getDevice(0); + ClDevice &device = *context.getDevice(0); auto info = new KernelInfo(); const size_t crossThreadSize = 160; @@ -545,7 +547,7 @@ class MockParentKernel : public Kernel { return parent; } - MockParentKernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg) { + MockParentKernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg) { } ~MockParentKernel() { @@ -592,12 +594,12 @@ class MockParentKernel : public Kernel { class MockSchedulerKernel : public SchedulerKernel { public: - MockSchedulerKernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg) : SchedulerKernel(programArg, kernelInfoArg, deviceArg){}; + MockSchedulerKernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg) : SchedulerKernel(programArg, kernelInfoArg, deviceArg){}; }; class MockDebugKernel : public MockKernel { public: - MockDebugKernel(Program *program, KernelInfo &kernelInfo, const Device &device) : MockKernel(program, kernelInfo, device) { + MockDebugKernel(Program *program, KernelInfo &kernelInfo, const ClDevice &device) : MockKernel(program, kernelInfo, device) { if (!kernelInfo.patchInfo.pAllocateSystemThreadSurface) { SPatchAllocateSystemThreadSurface *patchToken = new SPatchAllocateSystemThreadSurface; diff --git a/unit_tests/mocks/mock_program.cpp b/unit_tests/mocks/mock_program.cpp index 091cb75f28..7747444c56 100644 --- a/unit_tests/mocks/mock_program.cpp +++ b/unit_tests/mocks/mock_program.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,6 +19,9 @@ namespace NEO { GlobalMockSipProgram *GlobalMockSipProgram::sipProgram; ExecutionEnvironment GlobalMockSipProgram::executionEnvironment; + +ClDevice *MockProgram::getDevicePtr() { return this->pDevice; } + std::string MockProgram::getCachedFileName() const { auto hwInfo = this->context->getDevice(0)->getHardwareInfo(); auto input = ArrayRef(this->sourceCode.c_str(), this->sourceCode.size()); diff --git a/unit_tests/mocks/mock_program.h b/unit_tests/mocks/mock_program.h index 34a1e7356c..c06e9cc614 100644 --- a/unit_tests/mocks/mock_program.h +++ b/unit_tests/mocks/mock_program.h @@ -85,7 +85,7 @@ class MockProgram : public Program { void setGlobalSurface(GraphicsAllocation *gfxAllocation) { globalSurface = gfxAllocation; } - void setDevice(Device *device) { + void setDevice(ClDevice *device) { this->pDevice = device; }; std::vector &getKernelInfoArray() { @@ -111,7 +111,7 @@ class MockProgram : public Program { void SetCreatedFromBinary(bool createdFromBin) { isCreatedFromBinary = createdFromBin; } void ClearLog() { buildLog.clear(); } void SetGlobalVariableTotalSize(size_t globalVarSize) { globalVarTotalSize = globalVarSize; } - void SetDevice(Device *pDev) { pDevice = pDev; } + void SetDevice(ClDevice *pDev) { pDevice = pDev; } void SetIrBinary(char *ptr, bool isSpirv) { irBinary.reset(ptr); @@ -127,7 +127,7 @@ class MockProgram : public Program { allowNonUniform = allow; } - Device *getDevicePtr() { return this->pDevice; } + ClDevice *getDevicePtr(); bool isFlagOption(ConstStringRef option) override { if (isFlagOptionOverride != -1) { diff --git a/unit_tests/mt_tests/device_queue/device_queue_mt_tests.cpp b/unit_tests/mt_tests/device_queue/device_queue_mt_tests.cpp index 138527028f..c6b96b3c15 100644 --- a/unit_tests/mt_tests/device_queue/device_queue_mt_tests.cpp +++ b/unit_tests/mt_tests/device_queue/device_queue_mt_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,7 +15,7 @@ using namespace NEO; typedef ::testing::Test DeviceQueueHwMtTest; HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueHwMtTest, givenTakenIgilCriticalSectionWhenSecondThreadIsWaitingThenDontHang) { - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = std::unique_ptr(new MockContext()); cl_queue_properties properties[3] = {0}; diff --git a/unit_tests/os_interface/linux/device_os_tests.cpp b/unit_tests/os_interface/linux/device_os_tests.cpp index 21c9a644dc..d57f5ee130 100644 --- a/unit_tests/os_interface/linux/device_os_tests.cpp +++ b/unit_tests/os_interface/linux/device_os_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,7 +22,7 @@ using namespace ::testing; namespace NEO { -TEST(DeviceOsTest, osSpecificExtensions) { +TEST(DeviceOsTest, GivenDefaultDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) { auto hwInfo = *platformDevices; auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); @@ -38,8 +38,25 @@ TEST(DeviceOsTest, osSpecificExtensions) { delete pDevice; } +TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) { + auto hwInfo = *platformDevices; + auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); + auto pClDevice = new ClDevice{*pDevice}; + + std::string extensionString(pClDevice->getDeviceInfo().deviceExtensions); + + EXPECT_THAT(extensionString, Not(testing::HasSubstr(std::string("cl_intel_dx9_media_sharing ")))); + EXPECT_THAT(extensionString, Not(testing::HasSubstr(std::string("cl_khr_dx9_media_sharing ")))); + EXPECT_THAT(extensionString, Not(testing::HasSubstr(std::string("cl_khr_d3d10_sharing ")))); + EXPECT_THAT(extensionString, Not(testing::HasSubstr(std::string("cl_khr_d3d11_sharing ")))); + EXPECT_THAT(extensionString, Not(testing::HasSubstr(std::string("cl_intel_d3d11_nv12_media_sharing ")))); + EXPECT_THAT(extensionString, Not(testing::HasSubstr(std::string("cl_intel_simultaneous_sharing ")))); + + delete pClDevice; +} + TEST(DeviceOsTest, supportedSimultaneousInterops) { - auto pDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto pDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); std::vector expected = {0}; diff --git a/unit_tests/os_interface/linux/drm_memory_manager_tests.h b/unit_tests/os_interface/linux/drm_memory_manager_tests.h index 6f967feea1..6034cb00a6 100644 --- a/unit_tests/os_interface/linux/drm_memory_manager_tests.h +++ b/unit_tests/os_interface/linux/drm_memory_manager_tests.h @@ -36,7 +36,7 @@ class DrmMemoryManagerFixture : public MemoryManagementFixture { public: std::unique_ptr mock; TestedDrmMemoryManager *memoryManager = nullptr; - MockDevice *device = nullptr; + MockClDevice *device = nullptr; void SetUp() override { SetUp(new DrmMockCustom, false); @@ -56,7 +56,7 @@ class DrmMemoryManagerFixture : public MemoryManagementFixture { if (memoryManager->getgemCloseWorker()) { memoryManager->getgemCloseWorker()->close(true); } - device = MockDevice::createWithExecutionEnvironment(*platformDevices, executionEnvironment, 0); + device = new MockClDevice{MockDevice::createWithExecutionEnvironment(*platformDevices, executionEnvironment, 0)}; } void TearDown() override { diff --git a/unit_tests/os_interface/linux/linux_create_command_queue_with_properties_tests.cpp b/unit_tests/os_interface/linux/linux_create_command_queue_with_properties_tests.cpp index a0ff1322b2..e3c0a0e195 100644 --- a/unit_tests/os_interface/linux/linux_create_command_queue_with_properties_tests.cpp +++ b/unit_tests/os_interface/linux/linux_create_command_queue_with_properties_tests.cpp @@ -25,17 +25,17 @@ struct clCreateCommandQueueWithPropertiesLinux : public UltCommandStreamReceiver osInterface->get()->setDrm(drm.get()); executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface); executionEnvironment->memoryManager.reset(new TestedDrmMemoryManager(*executionEnvironment)); - mdevice.reset(MockDevice::create(executionEnvironment, 0u)); + mdevice = std::make_unique(MockDevice::create(executionEnvironment, 0u)); clDevice = mdevice.get(); retVal = CL_SUCCESS; - context = std::unique_ptr(Context::create(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); + context = std::unique_ptr(Context::create(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal)); } void TearDown() override { UltCommandStreamReceiverTest::TearDown(); } std::unique_ptr drm = std::make_unique(); - std::unique_ptr mdevice = nullptr; + std::unique_ptr mdevice = nullptr; std::unique_ptr context; cl_device_id clDevice; cl_int retVal; @@ -139,7 +139,7 @@ HWTEST_F(clCreateCommandQueueWithPropertiesLinux, givenPropertiesWithClQueueSlic ssh, taskLevel, dispatchFlags, - *mdevice); + mdevice->getDevice()); auto expectedSliceMask = drm->getSliceMask(newSliceCount); EXPECT_EQ(expectedSliceMask, drm->storedParamSseu); drm_i915_gem_context_param_sseu sseu = {}; @@ -184,7 +184,7 @@ HWTEST_F(clCreateCommandQueueWithPropertiesLinux, givenSameSliceCountAsRecentlyS ssh, taskLevel, dispatchFlags, - *mdevice); + mdevice->getDevice()); auto expectedSliceMask = drm->getSliceMask(newSliceCount); EXPECT_NE(expectedSliceMask, drm->storedParamSseu); drm_i915_gem_context_param_sseu sseu = {}; @@ -228,7 +228,7 @@ HWTEST_F(clCreateCommandQueueWithPropertiesLinux, givenPropertiesWithClQueueSlic ssh, taskLevel, dispatchFlags, - *mdevice); + mdevice->getDevice()); EXPECT_NE(newSliceCount, mockCsr->lastSentSliceCount); EXPECT_EQ(lastSliceCountBeforeFlushTask, mockCsr->lastSentSliceCount); diff --git a/unit_tests/os_interface/linux/mock_performance_counters_linux.cpp b/unit_tests/os_interface/linux/mock_performance_counters_linux.cpp index 7d858450dc..ed102dbb39 100644 --- a/unit_tests/os_interface/linux/mock_performance_counters_linux.cpp +++ b/unit_tests/os_interface/linux/mock_performance_counters_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -37,14 +37,14 @@ std::unique_ptr MockPerformanceCounters::create(Device *dev // PerformanceCountersFixture::createPerfCounters ////////////////////////////////////////////////////// void PerformanceCountersFixture::createPerfCounters() { - performanceCountersBase = MockPerformanceCounters::create(device.get()); + performanceCountersBase = MockPerformanceCounters::create(&device->getDevice()); } ////////////////////////////////////////////////////// // PerformanceCountersFixture::SetUp ////////////////////////////////////////////////////// void PerformanceCountersFixture::SetUp() { - device = std::unique_ptr(new MockDevice()); + device = std::make_unique(new MockDevice()); context = std::make_unique(device.get()); queue = std::make_unique(context.get(), device.get(), &queueProperties); osInterface = std::unique_ptr(new OSInterface()); diff --git a/unit_tests/os_interface/mock_performance_counters.cpp b/unit_tests/os_interface/mock_performance_counters.cpp index d2c06d1a9e..c98d9237e0 100644 --- a/unit_tests/os_interface/mock_performance_counters.cpp +++ b/unit_tests/os_interface/mock_performance_counters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -361,7 +361,7 @@ PerformanceCountersFixture::~PerformanceCountersFixture() { // PerformanceCountersMetricsLibraryFixture::createPerformanceCounters ////////////////////////////////////////////////////// void PerformanceCountersMetricsLibraryFixture::createPerformanceCounters(const bool validMetricsLibraryApi, const bool mockMetricsLibrary) { - performanceCountersBase = MockPerformanceCounters::create(device.get()); + performanceCountersBase = MockPerformanceCounters::create(&device->getDevice()); auto metricsLibraryInterface = performanceCountersBase->getMetricsLibraryInterface(); auto metricsLibraryDll = std::make_unique(); EXPECT_NE(performanceCountersBase, nullptr); diff --git a/unit_tests/os_interface/mock_performance_counters.h b/unit_tests/os_interface/mock_performance_counters.h index e781171a98..ebc686b436 100644 --- a/unit_tests/os_interface/mock_performance_counters.h +++ b/unit_tests/os_interface/mock_performance_counters.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -227,7 +227,7 @@ struct PerformanceCountersFixture { virtual void TearDown(); virtual void createPerfCounters(); cl_queue_properties queueProperties = {}; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr queue; std::unique_ptr osInterface; diff --git a/unit_tests/os_interface/performance_counters_tests.cpp b/unit_tests/os_interface/performance_counters_tests.cpp index f84230525f..9d5e457a81 100644 --- a/unit_tests/os_interface/performance_counters_tests.cpp +++ b/unit_tests/os_interface/performance_counters_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -54,7 +54,7 @@ struct PerformanceCountersTest : public PerformanceCountersFixture, }; TEST_F(PerformanceCountersTest, createPerformanceCounters) { - auto performanceCounters = PerformanceCounters::create(device.get()); + auto performanceCounters = PerformanceCounters::create(&device->getDevice()); EXPECT_NE(nullptr, performanceCounters); EXPECT_NE(nullptr, performanceCounters.get()); } diff --git a/unit_tests/os_interface/windows/device_os_tests.cpp b/unit_tests/os_interface/windows/device_os_tests.cpp index 47eb59d86a..6d059c204a 100644 --- a/unit_tests/os_interface/windows/device_os_tests.cpp +++ b/unit_tests/os_interface/windows/device_os_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,7 +17,7 @@ using namespace ::testing; namespace NEO { -TEST(DeviceOsTest, osSpecificExtensions) { +TEST(DeviceOsTest, GivenDefaultDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) { auto hwInfo = *platformDevices; auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); @@ -29,13 +29,31 @@ TEST(DeviceOsTest, osSpecificExtensions) { EXPECT_THAT(extensionString, HasSubstr(std::string("cl_khr_d3d10_sharing "))); EXPECT_THAT(extensionString, HasSubstr(std::string("cl_khr_d3d11_sharing "))); EXPECT_THAT(extensionString, HasSubstr(std::string("cl_intel_d3d11_nv12_media_sharing "))); - EXPECT_THAT(extensionString, HasSubstr(std::string("cl_intel_simultaneous_sharing "))); + EXPECT_THAT(extensionString, Not(HasSubstr(std::string("cl_intel_simultaneous_sharing ")))); delete pDevice; } +TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) { + auto hwInfo = *platformDevices; + auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); + auto pClDevice = new ClDevice{*pDevice}; + + std::string extensionString(pClDevice->getDeviceInfo().deviceExtensions); + + EXPECT_THAT(extensionString, Not(HasSubstr(std::string("cl_intel_va_api_media_sharing ")))); + EXPECT_THAT(extensionString, HasSubstr(std::string("cl_intel_dx9_media_sharing "))); + EXPECT_THAT(extensionString, HasSubstr(std::string("cl_khr_dx9_media_sharing "))); + EXPECT_THAT(extensionString, HasSubstr(std::string("cl_khr_d3d10_sharing "))); + EXPECT_THAT(extensionString, HasSubstr(std::string("cl_khr_d3d11_sharing "))); + EXPECT_THAT(extensionString, HasSubstr(std::string("cl_intel_d3d11_nv12_media_sharing "))); + EXPECT_THAT(extensionString, HasSubstr(std::string("cl_intel_simultaneous_sharing "))); + + delete pClDevice; +} + TEST(DeviceOsTest, supportedSimultaneousInterops) { - auto pDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto pDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); std::vector expected = {CL_GL_CONTEXT_KHR, CL_WGL_HDC_KHR, diff --git a/unit_tests/os_interface/windows/mock_performance_counters_win.cpp b/unit_tests/os_interface/windows/mock_performance_counters_win.cpp index c35e919ac0..5797f61600 100644 --- a/unit_tests/os_interface/windows/mock_performance_counters_win.cpp +++ b/unit_tests/os_interface/windows/mock_performance_counters_win.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -41,14 +41,14 @@ MockPerformanceCountersWin::MockPerformanceCountersWin(Device *device) // PerformanceCountersFixture::createPerfCounters ////////////////////////////////////////////////////// void PerformanceCountersFixture::createPerfCounters() { - performanceCountersBase = MockPerformanceCounters::create(device.get()); + performanceCountersBase = MockPerformanceCounters::create(&device->getDevice()); } ////////////////////////////////////////////////////// // PerformanceCountersFixture::SetUp ////////////////////////////////////////////////////// void PerformanceCountersFixture::SetUp() { - device = std::unique_ptr(new MockDevice()); + device = std::make_unique(new MockDevice()); context = std::make_unique(device.get()); queue = std::make_unique(context.get(), device.get(), &queueProperties); osInterface = std::unique_ptr(new OSInterface()); 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 ad0f02fda5..a2a132d182 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -658,7 +658,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreat if (!UnitTestHelper::tiledImagesSupported) { GTEST_SKIP(); } - std::unique_ptr device(MockDevice::createWithExecutionEnvironment(*platformDevices, executionEnvironment, 0u)); + + auto device = std::make_unique(MockDevice::createWithExecutionEnvironment(*platformDevices, executionEnvironment, 0u)); MockContext context(device.get()); context.memoryManager = memoryManager.get(); diff --git a/unit_tests/platform/platform_tests.cpp b/unit_tests/platform/platform_tests.cpp index 5c0e37c1eb..b1b94b8cdd 100644 --- a/unit_tests/platform/platform_tests.cpp +++ b/unit_tests/platform/platform_tests.cpp @@ -60,29 +60,41 @@ struct MockPlatformWithMockExecutionEnvironment : public Platform { } }; -TEST_F(PlatformTest, getDevices) { - size_t devNum = pPlatform->getNumDevices(); - EXPECT_EQ(0u, devNum); - - Device *device = pPlatform->getDevice(0); - EXPECT_EQ(nullptr, device); - - bool ret = pPlatform->initialize(); - EXPECT_TRUE(ret); +TEST_F(PlatformTest, GivenUninitializedPlatformWhenInitializeIsCalledThenPlatformIsInitialized) { + EXPECT_FALSE(pPlatform->isInitialized()); + EXPECT_TRUE(pPlatform->initialize()); EXPECT_TRUE(pPlatform->isInitialized()); +} - devNum = pPlatform->getNumDevices(); - EXPECT_EQ(numPlatformDevices, devNum); +TEST_F(PlatformTest, WhenGetNumDevicesIsCalledThenExpectedValuesAreReturned) { + EXPECT_EQ(0u, pPlatform->getNumDevices()); - device = pPlatform->getDevice(0); - EXPECT_NE(nullptr, device); + pPlatform->initialize(); - device = pPlatform->getDevice(numPlatformDevices); - EXPECT_EQ(nullptr, device); + EXPECT_GT(pPlatform->getNumDevices(), 0u); +} - auto allDevices = pPlatform->getDevices(); - EXPECT_NE(nullptr, allDevices); +TEST_F(PlatformTest, WhenGetDeviceIsCalledThenExpectedValuesAreReturned) { + EXPECT_EQ(nullptr, pPlatform->getDevice(0)); + EXPECT_EQ(nullptr, pPlatform->getClDevice(0)); + + pPlatform->initialize(); + + EXPECT_NE(nullptr, pPlatform->getDevice(0)); + EXPECT_NE(nullptr, pPlatform->getClDevice(0)); + + auto numDevices = pPlatform->getNumDevices(); + EXPECT_EQ(nullptr, pPlatform->getDevice(numDevices)); + EXPECT_EQ(nullptr, pPlatform->getClDevice(numDevices)); +} + +TEST_F(PlatformTest, WhenGetClDevicesIsCalledThenExpectedValuesAreReturned) { + EXPECT_EQ(nullptr, pPlatform->getClDevices()); + + pPlatform->initialize(); + + EXPECT_NE(nullptr, pPlatform->getClDevices()); } TEST_F(PlatformTest, givenDebugFlagSetWhenInitializingPlatformThenOverrideGpuAddressSpace) { @@ -364,12 +376,6 @@ TEST(PlatformConstructionTest, givenPlatformConstructorWhenItIsCalledAfterResetT platformImpl.reset(nullptr); } -TEST(PlatformConstructionTest, givenPlatformThatIsNotInitializedWhenGetDevicesIsCalledThenNullptrIsReturned) { - Platform platform; - auto devices = platform.getDevices(); - EXPECT_EQ(nullptr, devices); -} - TEST(PlatformInitLoopTests, givenPlatformWhenInitLoopHelperIsCalledThenItDoesNothing) { struct mockPlatform : public Platform { using Platform::initializationLoopHelper; diff --git a/unit_tests/profiling/profiling_tests.cpp b/unit_tests/profiling/profiling_tests.cpp index 7ccc2c9fb8..cb0a6385b5 100644 --- a/unit_tests/profiling/profiling_tests.cpp +++ b/unit_tests/profiling/profiling_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -82,7 +82,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingTests, GIVENCommandQueueWithProfilingAndFor typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); uint64_t requiredSize = 2 * sizeof(PIPE_CONTROL) + 2 * sizeof(MI_STORE_REGISTER_MEM) + sizeof(GPGPU_WALKER) + HardwareCommandsHelper::getSizeRequiredCS(&kernel); @@ -127,7 +127,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingTests, GIVENCommandQueueWithProfilingAndFor typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); uint64_t requiredSize = 2 * sizeof(PIPE_CONTROL) + 4 * sizeof(MI_STORE_REGISTER_MEM) + HardwareCommandsHelper::getSizeRequiredCS(&kernel); requiredSize += 2 * sizeof(GPGPU_WALKER); @@ -153,7 +153,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingTests, GIVENCommandQueueWithProfolingWHENWa typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -207,7 +207,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingTests, GIVENCommandQueueWithProflingWHENWal typedef typename FamilyType::MI_STORE_REGISTER_MEM MI_STORE_REGISTER_MEM; typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -261,7 +261,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingTests, GIVENCommandQueueBlockedWithProfilin typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -318,7 +318,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingTests, GIVENCommandQueueBlockedWithProfilin typedef typename FamilyType::MI_STORE_REGISTER_MEM MI_STORE_REGISTER_MEM; typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER; - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -437,7 +437,7 @@ class MyOSTime : public OSTime { int MyOSTime::instanceNum = 0; TEST(EventProfilingTest, givenEventWhenCompleteIsZeroThenCalcProfilingDataSetsEndTimestampInCompleteTimestampAndDoesntCallOsTimeMethods) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MyOSTime::instanceNum = 0; device->setOSTime(new MyOSTime()); EXPECT_EQ(1, MyOSTime::instanceNum); @@ -472,7 +472,7 @@ TEST(EventProfilingTest, givenEventWhenCompleteIsZeroThenCalcProfilingDataSetsEn TEST(EventProfilingTest, givenRawTimestampsDebugModeWhenDataIsQueriedThenRawDataIsReturned) { DebugManagerStateRestore stateRestore; DebugManager.flags.ReturnRawGpuTimestamps.set(1); - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MyOSTime::instanceNum = 0; device->setOSTime(new MyOSTime()); EXPECT_EQ(1, MyOSTime::instanceNum); @@ -582,7 +582,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingWithPerfCountersTests, GIVENCommandQueueWit pCmdQ->setPerfCountersEnabled(); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -643,7 +643,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingWithPerfCountersTests, GIVENCommandQueueWit pCmdQ->setPerfCountersEnabled(); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -704,7 +704,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingWithPerfCountersTests, GIVENCommandQueueBlo pCmdQ->setPerfCountersEnabled(); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -768,7 +768,7 @@ HWTEST_F(ProfilingWithPerfCountersTests, pCmdQ->setPerfCountersEnabled(); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; @@ -842,7 +842,7 @@ HWTEST_F(ProfilingWithPerfCountersTests, GIVENCommandQueueWithProfilingPerfCount pCmdQ->setPerfCountersEnabled(); - MockKernel kernel(program.get(), kernelInfo, *pDevice); + MockKernel kernel(program.get(), kernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); size_t globalOffsets[3] = {0, 0, 0}; diff --git a/unit_tests/program/printf_handler_tests.cpp b/unit_tests/program/printf_handler_tests.cpp index 783ff269f5..9d17386503 100644 --- a/unit_tests/program/printf_handler_tests.cpp +++ b/unit_tests/program/printf_handler_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,7 +20,7 @@ using namespace NEO; TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResultIsNullptr) { - MockDevice *device = MockDevice::createWithNewExecutionEnvironment(nullptr); + MockClDevice *device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; MockContext context; SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface(); pPrintfSurface->DataParamOffset = 0; @@ -46,7 +46,7 @@ TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenR } TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResultIsNullptr) { - MockDevice *device = MockDevice::createWithNewExecutionEnvironment(nullptr); + MockClDevice *device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; MockContext context; SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface(); pPrintfSurface->DataParamOffset = 0; @@ -76,7 +76,7 @@ TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResu TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext context(device.get()); std::unique_ptr parentKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, false)); @@ -89,7 +89,7 @@ TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhe TEST(PrintfHandlerTest, givenParentKernelAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsNullptr) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext context(device.get()); std::unique_ptr blockKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, false, false)); @@ -101,7 +101,7 @@ TEST(PrintfHandlerTest, givenParentKernelAndBlockKernelWithoutPrintfWhenPrintfHa } TEST(PrintfHandlerTest, givenParentKernelWithPrintfAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) { - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockContext context(device.get()); std::unique_ptr parentKernelWithPrintfBlockKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, true, false)); @@ -114,7 +114,7 @@ TEST(PrintfHandlerTest, givenParentKernelWithPrintfAndBlockKernelWithoutPrintfWh TEST(PrintfHandlerTest, givenMultiDispatchInfoWithMultipleKernelsWhenCreatingAndDispatchingPrintfHandlerThenPickMainKernel) { MockContext context; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto program = std::make_unique(*device->getExecutionEnvironment(), &context, false); auto mainKernelInfo = std::make_unique(); auto kernelInfo = std::make_unique(); @@ -148,7 +148,7 @@ TEST(PrintfHandlerTest, givenMultiDispatchInfoWithMultipleKernelsWhenCreatingAnd } TEST(PrintfHandlerTest, GivenEmptyMultiDispatchInfoWhenCreatingPrintfHandlerThenPrintfHandlerIsNotCreated) { - MockDevice device; + MockClDevice device{new MockDevice}; MockKernelWithInternals mockKernelWithInternals{device}; MockMultiDispatchInfo multiDispatchInfo{mockKernelWithInternals.mockKernel}; multiDispatchInfo.dispatchInfos.resize(0); diff --git a/unit_tests/program/printf_helper_tests.cpp b/unit_tests/program/printf_helper_tests.cpp index 2ecf615646..b2bc41baf5 100644 --- a/unit_tests/program/printf_helper_tests.cpp +++ b/unit_tests/program/printf_helper_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -32,7 +32,7 @@ class PrintFormatterTest : public testing::Test { MockKernel *kernel; std::unique_ptr program; std::unique_ptr kernelInfo; - Device *device; + ClDevice *device; uint8_t underlyingBuffer[PrintFormatter::maxPrintfOutputLength]; uint32_t offset; @@ -46,7 +46,7 @@ class PrintFormatterTest : public testing::Test { data = new MockGraphicsAllocation(underlyingBuffer, PrintFormatter::maxPrintfOutputLength); kernelInfo = std::make_unique(); - device = MockDevice::createWithNewExecutionEnvironment(nullptr); + device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; program = std::make_unique(*device->getExecutionEnvironment()); kernel = new MockKernel(program.get(), *kernelInfo, *device); diff --git a/unit_tests/program/program_data_tests.cpp b/unit_tests/program/program_data_tests.cpp index 9e19ac9041..21d4978d1a 100644 --- a/unit_tests/program/program_data_tests.cpp +++ b/unit_tests/program/program_data_tests.cpp @@ -47,7 +47,7 @@ class ProgramDataTestBase : public testing::Test, void SetUp() override { PlatformFixture::SetUp(); - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); ContextFixture::SetUp(1, &device); ProgramFixture::SetUp(); @@ -723,7 +723,7 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) { TEST(ProgramScopeMetadataTest, WhenPatchingGlobalSurfaceThenPickProperSourceBuffer) { MockExecutionEnvironment execEnv; - MockDevice device; + MockClDevice device{new MockDevice}; execEnv.memoryManager = std::make_unique(); PatchTokensTestData::ValidProgramWithMixedGlobalVarAndConstSurfacesAndPointers decodedProgram; decodedProgram.globalPointerMutable->GlobalPointerOffset = 0U; @@ -742,7 +742,7 @@ TEST(ProgramScopeMetadataTest, WhenPatchingGlobalSurfaceThenPickProperSourceBuff } TEST_F(ProgramDataTest, GivenProgramWith32bitPointerOptWhenProgramScopeConstantBufferPatchTokensAreReadThenConstantPointerOffsetIsPatchedWith32bitPointer) { - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); CreateProgramWithSource(pContext, &device, "CopyBuffer_simd8.cl"); ASSERT_NE(nullptr, pProgram); @@ -785,7 +785,7 @@ TEST_F(ProgramDataTest, GivenProgramWith32bitPointerOptWhenProgramScopeConstantB } TEST_F(ProgramDataTest, GivenProgramWith32bitPointerOptWhenProgramScopeGlobalPointerPatchTokensAreReadThenGlobalPointerOffsetIsPatchedWith32bitPointer) { - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); CreateProgramWithSource(pContext, &device, "CopyBuffer_simd8.cl"); ASSERT_NE(nullptr, pProgram); diff --git a/unit_tests/program/program_from_binary.h b/unit_tests/program/program_from_binary.h index 719eff7a81..6780df38dc 100644 --- a/unit_tests/program/program_from_binary.h +++ b/unit_tests/program/program_from_binary.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,7 +39,7 @@ class ProgramFromBinaryTest : public DeviceFixture, DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); ProgramFixture::SetUp(); @@ -82,7 +82,7 @@ class ProgramSimpleFixture : public DeviceFixture, void SetUp() override { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); ProgramFixture::SetUp(); } diff --git a/unit_tests/program/program_nonuniform.cpp b/unit_tests/program/program_nonuniform.cpp index 4b719e9b28..eea845b1d5 100644 --- a/unit_tests/program/program_nonuniform.cpp +++ b/unit_tests/program/program_nonuniform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -102,10 +102,10 @@ TEST(ProgramNonUniform, UpdateAllowNonUniform21UniformFlag) { TEST(KernelNonUniform, GetAllowNonUniformFlag) { KernelInfo ki; - MockDevice d; + MockClDevice d{new MockDevice}; MockProgram pm(*d.getExecutionEnvironment()); struct KernelMock : Kernel { - KernelMock(Program *p, KernelInfo &ki, Device &d) + KernelMock(Program *p, KernelInfo &ki, ClDevice &d) : Kernel(p, ki, d) { } }; @@ -175,10 +175,10 @@ class ProgramNonUniformTest : public ContextFixture, void SetUp() override { PlatformFixture::SetUp(); - device = pPlatform->getDevice(0); + device = pPlatform->getClDevice(0); ContextFixture::SetUp(1, &device); ProgramFixture::SetUp(); - CommandQueueHwFixture::SetUp(pPlatform->getDevice(0), 0); + CommandQueueHwFixture::SetUp(pPlatform->getClDevice(0), 0); } void TearDown() override { diff --git a/unit_tests/program/program_tests.cpp b/unit_tests/program/program_tests.cpp index efc46abb5e..5440f53723 100644 --- a/unit_tests/program/program_tests.cpp +++ b/unit_tests/program/program_tests.cpp @@ -49,7 +49,7 @@ using namespace NEO; void ProgramTests::SetUp() { DeviceFixture::SetUp(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ContextFixture::SetUp(1, &device); } void ProgramTests::TearDown() { @@ -104,7 +104,7 @@ class SucceedingGenBinaryProgram : public MockProgram { }; TEST_P(ProgramFromBinaryTest, BuildProgram) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ASSERT_NE(nullptr, pProgram); retVal = pProgram->build( 1, @@ -214,7 +214,7 @@ TEST_P(ProgramFromBinaryTest, GetInfo_NumKernels) { size_t param_value; size_t param_value_size = sizeof(param_value); size_t param_value_size_ret; - cl_device_id device = pDevice; + cl_device_id device = pClDevice; // get info successfully ASSERT_EQ(CL_SUCCESS, retVal); @@ -255,7 +255,7 @@ TEST_P(ProgramFromBinaryTest, GetInfo_KernelNames) { size_t paramValueSize = sizeof(size_t *); char *param_value = nullptr; size_t param_value_size_ret = 0; - cl_device_id device = pDevice; + cl_device_id device = pClDevice; ASSERT_EQ(CL_SUCCESS, retVal); retVal = pProgram->build( @@ -319,7 +319,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_InvalidDevice) { // get build info for invalid device size_t invalidDevice = 0xdeadbee0; retVal = pProgram->getBuildInfo( - reinterpret_cast(invalidDevice), + reinterpret_cast(invalidDevice), paramName, param_value_size, &buildStatus, @@ -327,13 +327,13 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_InvalidDevice) { EXPECT_EQ(CL_INVALID_DEVICE, retVal); // get build info for corrupted device object - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, BinaryFileName); MockProgram *p = pProgram; - p->SetDevice(reinterpret_cast(pContext)); + p->SetDevice(reinterpret_cast(pContext)); retVal = pProgram->getBuildInfo( - reinterpret_cast(pContext), + reinterpret_cast(pContext), paramName, param_value_size, &buildStatus, @@ -342,7 +342,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_InvalidDevice) { } TEST_P(ProgramFromBinaryTest, GetBuildInfo_Status) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; cl_build_status buildStatus; cl_program_build_info paramName = CL_PROGRAM_BUILD_STATUS; size_t param_value_size = sizeof(buildStatus); @@ -363,7 +363,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_Status) { } TEST_P(ProgramFromBinaryTest, GetBuildInfo_Options) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; cl_program_build_info paramName = CL_PROGRAM_BUILD_OPTIONS; size_t param_value_size_ret = 0u; char *param_value = nullptr; @@ -400,7 +400,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_Options) { } TEST_P(ProgramFromBinaryTest, GetBuildInfo_Log) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; cl_program_build_info paramName = CL_PROGRAM_BUILD_LOG; size_t param_value_size_ret = 0u; char *param_value = nullptr; @@ -437,7 +437,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_Log) { } TEST_P(ProgramFromBinaryTest, GetBuildInfo_AppendedLog) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; cl_program_build_info paramName = CL_PROGRAM_BUILD_LOG; size_t param_value_size_ret = 0u; char *param_value = nullptr; @@ -470,8 +470,8 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_AppendedLog) { EXPECT_EQ(0, strcmp("", (char *)param_value)); // Add more text to the log - pProgram->updateBuildLog(pDevice, "testing", 8); - pProgram->updateBuildLog(pDevice, "several", 8); + pProgram->updateBuildLog(pClDevice, "testing", 8); + pProgram->updateBuildLog(pClDevice, "several", 8); retVal = pProgram->getBuildInfo( device, @@ -508,7 +508,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_AppendedLog) { } TEST_P(ProgramFromBinaryTest, GetBuildInfo_BinaryType) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; cl_program_build_info paramName = CL_PROGRAM_BINARY_TYPE; cl_program_binary_type program_type; size_t param_value_size_ret = 0u; @@ -551,7 +551,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_BinaryType) { } TEST_P(ProgramFromBinaryTest, GetBuildInfo_GlobalVariableTotalSize) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; size_t globalVarSize = 22; cl_program_build_info paramName = CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE; size_t param_value_size = sizeof(globalVarSize); @@ -590,7 +590,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_GlobalVariableTotalSize) { } TEST_P(ProgramFromBinaryTest, givenProgramWhenItIsBeingBuildThenItContainsGraphicsAllocationInKernelInfo) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; pProgram->build(1, &device, nullptr, nullptr, nullptr, true); auto kernelInfo = pProgram->getKernelInfo(size_t(0)); @@ -607,7 +607,7 @@ TEST_P(ProgramFromBinaryTest, givenProgramWhenItIsBeingBuildThenItContainsGraphi } TEST_P(ProgramFromBinaryTest, givenProgramWhenCleanKernelInfoIsCalledThenKernelAllocationIsFreed) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; pProgram->build(1, &device, nullptr, nullptr, nullptr, true); EXPECT_EQ(1u, pProgram->getNumKernels()); pProgram->cleanCurrentKernelInfo(); @@ -615,7 +615,7 @@ TEST_P(ProgramFromBinaryTest, givenProgramWhenCleanKernelInfoIsCalledThenKernelA } HWTEST_P(ProgramFromBinaryTest, givenProgramWhenCleanCurrentKernelInfoIsCalledButGpuIsNotYetDoneThenKernelAllocationIsPutOnDefferedFreeListAndCsrRegistersCacheFlush) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; auto &csr = pDevice->getGpgpuCommandStreamReceiver(); EXPECT_TRUE(csr.getTemporaryAllocations().peekIsEmpty()); pProgram->build(1, &device, nullptr, nullptr, nullptr, true); @@ -632,7 +632,7 @@ HWTEST_P(ProgramFromBinaryTest, givenIsaAllocationUsedByMultipleCsrsWhenItIsDele auto &csr0 = this->pDevice->getUltCommandStreamReceiverFromIndex(0u); auto &csr1 = this->pDevice->getUltCommandStreamReceiverFromIndex(1u); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; pProgram->build(1, &device, nullptr, nullptr, nullptr, true); @@ -661,7 +661,7 @@ TEST_P(ProgramFromSourceTest, CreateWithSource_Build) { cl_device_id deviceList = {0}; char data[4] = {0}; - cl_device_id usedDevice = pPlatform->getDevice(0); + cl_device_id usedDevice = pPlatform->getClDevice(0); CreateProgramWithSource( pContext, @@ -708,7 +708,7 @@ TEST_P(ProgramFromSourceTest, CreateWithSource_Build) { // fail build - linked code is corrupted and cannot be postprocessed auto p3 = std::make_unique(*pPlatform->getDevice(0)->getExecutionEnvironment()); - Device *device = pPlatform->getDevice(0); + ClDevice *device = pPlatform->getClDevice(0); p3->setDevice(device); std::string testFile; size_t sourceSize; @@ -822,7 +822,7 @@ std::map Callback::watchList; TEST_P(ProgramFromSourceTest, CreateWithSource_BuildFromCache) { KernelBinaryHelper kbHelper(BinaryFileName, true); - cl_device_id usedDevice = pPlatform->getDevice(0); + cl_device_id usedDevice = pPlatform->getClDevice(0); CreateProgramWithSource( pContext, &usedDevice, @@ -874,7 +874,7 @@ TEST_P(ProgramFromSourceTest, CreateWithNoStrings) { TEST_P(ProgramFromSourceTest, CreateWithSource_Compile) { - cl_device_id usedDevice = pPlatform->getDevice(0); + cl_device_id usedDevice = pPlatform->getClDevice(0); CreateProgramWithSource( pContext, &usedDevice, @@ -1008,7 +1008,7 @@ TEST_P(ProgramFromSourceTest, CompileProgramWithInternalFlags) { MockCompIfaceExecutionEnvironment executionEnvironment(cip.get()); auto program = std::make_unique(executionEnvironment); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); program->setDevice(pDevice); program->sourceCode = "__kernel mock() {}"; @@ -1092,7 +1092,7 @@ TEST_P(ProgramFromSourceTest, CreateWithSourceAdvanced) { } TEST_P(ProgramFromSourceTest, CreateWithSource_Link) { - cl_device_id usedDevice = pPlatform->getDevice(0); + cl_device_id usedDevice = pPlatform->getClDevice(0); CreateProgramWithSource( pContext, &usedDevice, @@ -1169,7 +1169,7 @@ TEST_P(ProgramFromSourceTest, CreateWithSource_Link) { // fail linking - linked code is corrupted and cannot be postprocessed auto p2 = std::make_unique(*pPlatform->getDevice(0)->getExecutionEnvironment()); - Device *device = pPlatform->getDevice(0); + ClDevice *device = pPlatform->getClDevice(0); p2->setDevice(device); retVal = p2->link(0, nullptr, nullptr, 1, &program, nullptr, nullptr); EXPECT_EQ(CL_INVALID_BINARY, retVal); @@ -1242,7 +1242,7 @@ class CommandStreamReceiverMock : public UltCommandStreamReceiver { }; HWTEST_F(PatchTokenTests, givenKernelRequiringConstantAllocationWhenMakeResidentIsCalledThenConstantAllocationIsMadeResident) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "test_constant_memory"); @@ -1311,7 +1311,7 @@ HWTEST_F(PatchTokenTests, givenKernelRequiringConstantAllocationWhenMakeResident } TEST_F(PatchTokenTests, DataParamGWS) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "kernel_data_param"); @@ -1335,7 +1335,7 @@ TEST_F(PatchTokenTests, DataParamGWS) { } TEST_F(PatchTokenTests, DataParamLWS) { - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "kernel_data_param"); @@ -1370,7 +1370,7 @@ TEST_F(PatchTokenTests, DataParamLWS) { TEST_F(PatchTokenTests, ConstantMemoryObjectKernelArg) { // PATCH_TOKEN_STATELESS_CONSTANT_MEMORY_OBJECT_KERNEL_ARGUMENT - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "test_basic_constant"); @@ -1413,7 +1413,7 @@ TEST_F(PatchTokenTests, VmeKernelArg) { GTEST_SKIP(); } // PATCH_TOKEN_INLINE_VME_SAMPLER_INFO token indicates a VME kernel. - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "vme_kernels"); @@ -1586,7 +1586,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptions) { DebugManager.flags.DisableStatelessToStatefulOptimization.set(false); MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false); char paramValue[32]; - pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); + pClDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); if (strstr(paramValue, "2.1")) { EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), "-ocl-version=210")) << program.getInternalOptions(); } else if (strstr(paramValue, "2.0")) { @@ -1605,7 +1605,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsForced20) { pDevice->deviceInfo.clVersion = "OpenCL 2.0"; MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false); char paramValue[32]; - pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); + pClDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); EXPECT_STREQ("OpenCL 2.0", paramValue); EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), "-ocl-version=200")); pDevice->deviceInfo.clVersion = defaultVersion; @@ -1617,7 +1617,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsWhenStatelessToStateful DebugManager.flags.DisableStatelessToStatefulOptimization.set(true); MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false); char paramValue[32]; - pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); + pClDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); if (strstr(paramValue, "2.1")) { EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), "-ocl-version=210")) << program.getInternalOptions(); EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), NEO::CompilerOptions::greaterThan4gbBuffersRequired)); @@ -1684,7 +1684,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsWhenForcing32BitAddress const_cast(&pDevice->getDeviceInfo())->force32BitAddressess = true; MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false); char paramValue[32]; - pDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); + pClDevice->getDeviceInfo(CL_DEVICE_VERSION, 32, paramValue, 0); if (strstr(paramValue, "2.1")) { EXPECT_TRUE(CompilerOptions::contains(program.getInternalOptions(), "-ocl-version=210")) << program.getInternalOptions(); } else if (strstr(paramValue, "2.0")) { @@ -1709,7 +1709,7 @@ TEST_F(ProgramTests, BuiltinProgramCreateSetsProperInternalOptions) { auto defaultSetting = DebugManager.flags.DisableStatelessToStatefulOptimization.get(); DebugManager.flags.DisableStatelessToStatefulOptimization.set(false); - std::unique_ptr program{Program::create("", pContext, *pDevice, true, nullptr)}; + std::unique_ptr program{Program::create("", pContext, *pClDevice, true, nullptr)}; if ((false == pDevice->areSharedSystemAllocationsAllowed()) && (false == is32bit)) { EXPECT_FALSE(CompilerOptions::contains(program->getInternalOptions(), NEO::CompilerOptions::greaterThan4gbBuffersRequired)) << program->getInternalOptions(); } else { @@ -1722,13 +1722,13 @@ TEST_F(ProgramTests, BuiltinProgramCreateSetsProperInternalOptionsWhenStatelessT auto defaultSetting = DebugManager.flags.DisableStatelessToStatefulOptimization.get(); DebugManager.flags.DisableStatelessToStatefulOptimization.set(true); - std::unique_ptr program{Program::create("", pContext, *pDevice, true, nullptr)}; + std::unique_ptr program{Program::create("", pContext, *pClDevice, true, nullptr)}; EXPECT_TRUE(CompilerOptions::contains(program->getInternalOptions(), NEO::CompilerOptions::greaterThan4gbBuffersRequired)) << program->getInternalOptions(); DebugManager.flags.DisableStatelessToStatefulOptimization.set(defaultSetting); } TEST_F(ProgramTests, givenProgramWhenItIsCompiledThenItAlwaysHavePreserveVec3TypeInternalOptionSet) { - std::unique_ptr program(Program::create("", pContext, *pDevice, true, nullptr)); + std::unique_ptr program(Program::create("", pContext, *pClDevice, true, nullptr)); EXPECT_TRUE(CompilerOptions::contains(program->getInternalOptions(), CompilerOptions::preserveVec3Type)) << program->getInternalOptions(); } @@ -1737,7 +1737,7 @@ TEST_F(ProgramTests, BuiltinProgramCreateSetsProperInternalOptionsWhenForcing32B DebugManager.flags.DisableStatelessToStatefulOptimization.set(false); const_cast(&pDevice->getDeviceInfo())->force32BitAddressess = true; - std::unique_ptr program{Program::create("", pContext, *pDevice, true, nullptr)}; + std::unique_ptr program{Program::create("", pContext, *pClDevice, true, nullptr)}; if (is32bit) { EXPECT_TRUE(CompilerOptions::contains(program->getInternalOptions(), CompilerOptions::greaterThan4gbBuffersRequired)) << program->getInternalOptions(); } else { @@ -1792,9 +1792,9 @@ TEST_F(ProgramTests, GivenContextWhenCreateProgramFromSourceThenIncrementContext auto initialApiRefCount = pContext->getReference(); auto initialInternalRefCount = pContext->getRefInternalCount(); - auto tempProgram = Program::create("", nullptr, *pDevice, false, nullptr); + auto tempProgram = Program::create("", nullptr, *pClDevice, false, nullptr); EXPECT_FALSE(tempProgram->getIsBuiltIn()); - auto program = Program::create("", pContext, *pDevice, false, nullptr); + auto program = Program::create("", pContext, *pClDevice, false, nullptr); EXPECT_FALSE(program->getIsBuiltIn()); EXPECT_EQ(pContext->getReference(), initialApiRefCount); @@ -1811,9 +1811,9 @@ TEST_F(ProgramTests, GivenContextWhenCreateBuiltInProgramFromSourceThenDontIncre auto initialApiRefCount = pContext->getReference(); auto initialInternalRefCount = pContext->getRefInternalCount(); - auto tempProgram = Program::create("", nullptr, *pDevice, true, nullptr); + auto tempProgram = Program::create("", nullptr, *pClDevice, true, nullptr); EXPECT_TRUE(tempProgram->getIsBuiltIn()); - auto program = Program::create("", pContext, *pDevice, true, nullptr); + auto program = Program::create("", pContext, *pClDevice, true, nullptr); EXPECT_TRUE(program->getIsBuiltIn()); EXPECT_EQ(pContext->getReference(), initialApiRefCount); @@ -1828,12 +1828,12 @@ TEST_F(ProgramTests, GivenContextWhenCreateBuiltInProgramFromSourceThenDontIncre TEST_F(ProgramTests, ProgramCreateT3Success) { cl_int retVal = CL_DEVICE_NOT_FOUND; - Program *pProgram = Program::create("", pContext, *pDevice, false, &retVal); + Program *pProgram = Program::create("", pContext, *pClDevice, false, &retVal); EXPECT_NE(nullptr, pProgram); EXPECT_EQ(CL_SUCCESS, retVal); delete pProgram; - pProgram = Program::create("", pContext, *pDevice, false, nullptr); + pProgram = Program::create("", pContext, *pClDevice, false, nullptr); EXPECT_NE(nullptr, pProgram); delete pProgram; } @@ -1927,7 +1927,7 @@ TEST_F(ProgramTests, ProgramFromGenBinaryWithPATCH_TOKEN_GLOBAL_MEMORY_OBJECT_KE EXPECT_EQ((uint32_t)CL_PROGRAM_BINARY_TYPE_EXECUTABLE, (uint32_t)pProgram->getProgramBinaryType()); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); char *pBin = &genBin[0]; retVal = CL_INVALID_BINARY; binSize = 0; @@ -1995,7 +1995,7 @@ TEST_F(ProgramTests, givenProgramFromGenBinaryWhenSLMSizeIsBiggerThenDeviceLimit EXPECT_EQ((uint32_t)CL_PROGRAM_BINARY_TYPE_EXECUTABLE, (uint32_t)program->getProgramBinaryType()); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); program->setDevice(pDevice); char *pBin = &genBin[0]; retVal = CL_INVALID_BINARY; @@ -2059,7 +2059,7 @@ TEST_F(ProgramTests, ProgramFromGenBinaryWithPATCH_TOKEN_GTPIN_FREE_GRF_INFO) { EXPECT_EQ((uint32_t)CL_PROGRAM_BINARY_TYPE_EXECUTABLE, (uint32_t)pProgram->getProgramBinaryType()); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); char *pBin = &genBin[0]; retVal = CL_INVALID_BINARY; binSize = 0; @@ -2119,7 +2119,7 @@ TEST_F(ProgramTests, ValidBinaryWithIGCVersionEqual0) { auto program = std::make_unique(*pDevice->getExecutionEnvironment()); EXPECT_NE(nullptr, program); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); program->setDevice(pDevice); // Load a binary program file @@ -2169,7 +2169,7 @@ TEST_F(ProgramTests, RebuildBinaryButNoCompilerInterface) { auto program = std::make_unique(*noCompilerInterfaceExecutionEnvironment); EXPECT_NE(nullptr, program); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); program->setDevice(pDevice); // Load a binary program file @@ -2203,7 +2203,7 @@ TEST_F(ProgramTests, RebuildBinaryWithRebuildError) { MockCompIfaceExecutionEnvironment executionEnvironment(cip.get()); auto program = std::make_unique(executionEnvironment); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); program->setDevice(pDevice); // Load a binary program file @@ -2227,7 +2227,7 @@ TEST_F(ProgramTests, BuildProgramWithReraFlag) { MockCompIfaceExecutionEnvironment executionEnvironment(cip.get()); auto program = std::make_unique(executionEnvironment); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); program->setDevice(pDevice); program->sourceCode = "__kernel mock() {}"; @@ -2258,7 +2258,7 @@ TEST_F(ProgramTests, RebuildBinaryWithProcessGenBinaryError) { auto program = std::make_unique(*pDevice->getExecutionEnvironment()); EXPECT_NE(nullptr, program); cl_device_id deviceId = pContext->getDevice(0); - Device *pDevice = castToObject(deviceId); + ClDevice *pDevice = castToObject(deviceId); program->setDevice(pDevice); // Load a binary program file @@ -2475,7 +2475,7 @@ TEST_F(ProgramTests, givenProgramCreatedFromILWhenCompileIsCalledThenReuseTheILI cl_int errCode = 0; auto prog = Program::createFromIL(pContext, reinterpret_cast(spirv), sizeof(spirv), errCode); ASSERT_NE(nullptr, prog); - cl_device_id deviceId = pDevice; + cl_device_id deviceId = pClDevice; auto debugVars = NEO::getIgcDebugVars(); debugVars.forceBuildFailure = true; gEnvironment->fclPushDebugVars(debugVars); @@ -2488,7 +2488,7 @@ TEST_F(ProgramTests, givenProgramCreatedFromILWhenCompileIsCalledThenReuseTheILI TEST_F(ProgramTests, givenProgramCreatedFromIntermediateBinaryRepresentationWhenCompileIsCalledThenReuseTheILInsteadOfCallingCompilerInterface) { const uint32_t spirv[16] = {0x03022307}; cl_int errCode = 0; - cl_device_id deviceId = pDevice; + cl_device_id deviceId = pClDevice; cl_context ctx = pContext; size_t lengths = sizeof(spirv); const unsigned char *binaries[1] = {reinterpret_cast(spirv)}; @@ -2737,7 +2737,7 @@ TEST(SimpleProgramTests, givenDefaultProgramWhenSetDeviceIsCalledThenDeviceIsSet ExecutionEnvironment executionEnvironment; MockProgram program(executionEnvironment); EXPECT_EQ(nullptr, program.getDevicePtr()); - auto dummyDevice = (Device *)0x1337; + auto dummyDevice = (ClDevice *)0x1337; program.SetDevice(dummyDevice); EXPECT_EQ(dummyDevice, program.getDevicePtr()); program.SetDevice(nullptr); @@ -2746,7 +2746,7 @@ TEST(SimpleProgramTests, givenDefaultProgramWhenSetDeviceIsCalledThenDeviceIsSet TEST(ProgramDestructionTests, givenProgramUsingDeviceWhenItIsDestroyedAfterPlatfromCleanupThenItIsCleanedUpProperly) { platformImpl->initialize(); - auto device = platformImpl->getDevice(0); + auto device = platformImpl->getClDevice(0); MockContext *context = new MockContext(device, false); MockProgram *pProgram = new MockProgram(*device->getExecutionEnvironment(), context, false); auto globalAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -2760,7 +2760,7 @@ TEST(ProgramDestructionTests, givenProgramUsingDeviceWhenItIsDestroyedAfterPlatf } TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPathIsTaken) { - auto device = castToObject(pContext->getDevice(0)); + auto device = castToObject(pContext->getDevice(0)); auto compilerInterface = new MockCompilerInterface(); auto compilerMain = new MockCIFMain(); @@ -2803,7 +2803,7 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPat } TEST_F(ProgramTests, whenRebuildingProgramThenStoreDeviceBinaryProperly) { - auto device = castToObject(pContext->getDevice(0)); + auto device = castToObject(pContext->getDevice(0)); auto compilerInterface = new MockCompilerInterface(); pDevice->getExecutionEnvironment()->compilerInterface.reset(compilerInterface); @@ -2914,7 +2914,7 @@ class AdditionalOptionsMockProgram : public MockProgram { TEST_F(ProgramTests, givenProgramWhenBuiltThenAdditionalOptionsAreApplied) { AdditionalOptionsMockProgram program; - cl_device_id device = pDevice; + cl_device_id device = pClDevice; program.build(1, &device, nullptr, nullptr, nullptr, false); EXPECT_EQ(1u, program.applyAdditionalOptionsCalled); @@ -3043,7 +3043,7 @@ struct setProgramSpecializationConstantTests : public ::testing::Test { SpecializationConstantExecutionEnvironmentMock executionEnvironment; SpecializationConstantCompilerInterfaceMock *mockCompiler = reinterpret_cast(executionEnvironment.getCompilerInterface()); std::unique_ptr mockProgram; - MockDevice device; + MockClDevice device{new MockDevice}; int specValue = 1; }; @@ -3095,7 +3095,7 @@ TEST_F(ProgramBinTest, givenPrintProgramBinaryProcessingTimeSetWhenBuildProgramT DebugManager.flags.PrintProgramBinaryProcessingTime.set(true); testing::internal::CaptureStdout(); - cl_device_id device = pDevice; + cl_device_id device = pClDevice; CreateProgramFromBinary(pContext, &device, "kernel_data_param"); auto retVal = pProgram->build( @@ -3139,7 +3139,7 @@ struct DebugDataGuard { TEST_F(ProgramBinTest, GivenBuildWithDebugDataThenBuildDataAvailableViaGetInfo) { DebugDataGuard debugDataGuard; - cl_device_id device = pDevice; + cl_device_id device = pClDevice; const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n"; pProgram = Program::create( pContext, @@ -3195,7 +3195,7 @@ TEST_F(ProgramBinTest, GivenBuildWithDebugDataThenBuildDataAvailableViaGetInfo) TEST_F(ProgramBinTest, GivenDebugDataAvailableWhenLinkingProgramThenDebugDataIsStoredInProgram) { DebugDataGuard debugDataGuard; - cl_device_id device = pDevice; + cl_device_id device = pClDevice; const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n"; pProgram = Program::create( pContext, @@ -3236,4 +3236,4 @@ TEST_F(ProgramMultiRootDeviceTests, privateSurfaceHasCorrectRootDeviceIndex) { auto privateSurface = program->getBlockKernelManager()->getPrivateSurface(0); EXPECT_NE(nullptr, privateSurface); EXPECT_EQ(expectedRootDeviceIndex, privateSurface->getRootDeviceIndex()); -} \ No newline at end of file +} diff --git a/unit_tests/program/program_with_block_kernels_tests.cpp b/unit_tests/program/program_with_block_kernels_tests.cpp index 66ada7906e..84c1e334c8 100644 --- a/unit_tests/program/program_with_block_kernels_tests.cpp +++ b/unit_tests/program/program_with_block_kernels_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ class ProgramWithBlockKernelsTest : public ContextFixture, void SetUp() override { PlatformFixture::SetUp(); - device = pPlatform->getDevice(0); + device = pPlatform->getClDevice(0); ContextFixture::SetUp(1, &device); ProgramFixture::SetUp(); } diff --git a/unit_tests/program/program_with_kernel_debug_tests.cpp b/unit_tests/program/program_with_kernel_debug_tests.cpp index e477f2c58c..0a7158d30a 100644 --- a/unit_tests/program/program_with_kernel_debug_tests.cpp +++ b/unit_tests/program/program_with_kernel_debug_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -40,7 +40,7 @@ class ProgramWithKernelDebuggingTest : public ProgramSimpleFixture, public: void SetUp() override { ProgramSimpleFixture::SetUp(); - device = pDevice; + device = pClDevice; if (!pDevice->getHardwareInfo().capabilityTable.sourceLevelDebuggerSupported) { GTEST_SKIP(); } diff --git a/unit_tests/program/program_with_source.h b/unit_tests/program/program_with_source.h index b4d84bdb29..42799e42ca 100644 --- a/unit_tests/program/program_with_source.h +++ b/unit_tests/program/program_with_source.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,7 +39,7 @@ class ProgramFromSourceTest : public ContextFixture, kbHelper = new KernelBinaryHelper(BinaryFileName); PlatformFixture::SetUp(); - cl_device_id device = pPlatform->getDevice(0); + cl_device_id device = pPlatform->getClDevice(0); ContextFixture::SetUp(1, &device); ProgramFixture::SetUp(); diff --git a/unit_tests/sampler/sampler_set_arg_tests.cpp b/unit_tests/sampler/sampler_set_arg_tests.cpp index 1b950e8a55..b8f08e2569 100644 --- a/unit_tests/sampler/sampler_set_arg_tests.cpp +++ b/unit_tests/sampler/sampler_set_arg_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -55,7 +55,7 @@ class SamplerSetArgFixture : public DeviceFixture { pKernelInfo->kernelArgInfo[1].isSampler = true; program = std::make_unique(*pDevice->getExecutionEnvironment()); - pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice); + pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice); ASSERT_NE(nullptr, pKernel); ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); @@ -64,7 +64,7 @@ class SamplerSetArgFixture : public DeviceFixture { uint32_t crossThreadData[crossThreadDataSize] = {}; pKernel->setCrossThreadData(crossThreadData, sizeof(crossThreadData)); - context = new MockContext(pDevice); + context = new MockContext(pClDevice); retVal = CL_INVALID_VALUE; } @@ -200,7 +200,7 @@ HWTEST_F(SamplerSetArgTest, GivenSamplerObjectWhenSetKernelArgIsCalledThenSample } HWTEST_F(SamplerSetArgTest, GivenSamplerObjectWhenSetKernelArgIsCalledAndKernelIsDeletedThenRefCountIsUnchanged) { - auto myKernel = std::make_unique(program.get(), *pKernelInfo, *pDevice); + auto myKernel = std::make_unique(program.get(), *pKernelInfo, *pClDevice); ASSERT_NE(nullptr, myKernel.get()); ASSERT_EQ(CL_SUCCESS, myKernel->initialize()); @@ -372,7 +372,7 @@ TEST_F(SamplerSetArgTest, givenSamplerTypeStrAndIsSamplerTrueWhenInitializeKerne pKernelInfo->kernelArgInfo[1].typeStr = "sampler"; pKernelInfo->kernelArgInfo[1].isSampler = true; - auto pMockKernell = std::make_unique(program.get(), *pKernelInfo, *pDevice); + auto pMockKernell = std::make_unique(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pMockKernell->initialize()); EXPECT_EQ(pMockKernell->getKernelArguments()[0].type, MockKernel::SAMPLER_OBJ); EXPECT_EQ(pMockKernell->getKernelArguments()[1].type, MockKernel::SAMPLER_OBJ); @@ -385,7 +385,7 @@ TEST_F(SamplerSetArgTest, givenSamplerTypeStrAndAndIsSamplerFalseWhenInitializeK pKernelInfo->kernelArgInfo[1].typeStr = "sampler"; pKernelInfo->kernelArgInfo[1].isSampler = false; - auto pMockKernell = std::make_unique(program.get(), *pKernelInfo, *pDevice); + auto pMockKernell = std::make_unique(program.get(), *pKernelInfo, *pClDevice); ASSERT_EQ(CL_SUCCESS, pMockKernell->initialize()); EXPECT_NE(pMockKernell->getKernelArguments()[0].type, MockKernel::SAMPLER_OBJ); EXPECT_NE(pMockKernell->getKernelArguments()[1].type, MockKernel::SAMPLER_OBJ); diff --git a/unit_tests/scenarios/blocked_enqueue_barrier_scenario_tests.cpp b/unit_tests/scenarios/blocked_enqueue_barrier_scenario_tests.cpp index 6383f12226..31f954a451 100644 --- a/unit_tests/scenarios/blocked_enqueue_barrier_scenario_tests.cpp +++ b/unit_tests/scenarios/blocked_enqueue_barrier_scenario_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,7 +22,7 @@ typedef ScenarioTest BarrierScenarioTest; HWTEST_F(BarrierScenarioTest, givenBlockedEnqueueBarrierOnOOQWhenUserEventIsUnblockedThenNextEnqueuesAreNotBlocked) { cl_command_queue clCommandQ = nullptr; cl_queue_properties properties[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0}; - auto mockCmdQ = clUniquePtr(new MockCommandQueueHw(context, pPlatform->getDevice(0), properties)); + auto mockCmdQ = clUniquePtr(new MockCommandQueueHw(context, pPlatform->getClDevice(0), properties)); clCommandQ = mockCmdQ.get(); cl_kernel clKernel = kernel; 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 ecf79fd058..88d98a72da 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -42,7 +42,7 @@ struct EnqueueBufferWindowsTest : public HardwareParse, memoryManager = new MockWddmMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - device = std::unique_ptr(Device::create(executionEnvironment, 0)); + device = std::make_unique(Device::create(executionEnvironment, 0)); context = std::make_unique(device.get()); const size_t bufferMisalignment = 1; @@ -66,7 +66,7 @@ struct EnqueueBufferWindowsTest : public HardwareParse, ExecutionEnvironment *executionEnvironment; cl_queue_properties properties = {}; std::unique_ptr bufferMemory; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr context; std::unique_ptr buffer; diff --git a/unit_tests/scheduler/scheduler_kernel_tests.cpp b/unit_tests/scheduler/scheduler_kernel_tests.cpp index c4e40540a2..41d6bf6c38 100644 --- a/unit_tests/scheduler/scheduler_kernel_tests.cpp +++ b/unit_tests/scheduler/scheduler_kernel_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,7 @@ using namespace std; class MockSchedulerKernel : public SchedulerKernel { public: - MockSchedulerKernel(Program *program, const KernelInfo &info, const Device &device) : SchedulerKernel(program, info, device) { + MockSchedulerKernel(Program *program, const KernelInfo &info, const ClDevice &device) : SchedulerKernel(program, info, device) { } static MockSchedulerKernel *create(Program &program, Device &device, KernelInfo *&info) { @@ -59,7 +59,7 @@ class MockSchedulerKernel : public SchedulerKernel { }; TEST(SchedulerKernelTest, getLws) { - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; MockSchedulerKernel kernel(&program, info, *device); @@ -69,7 +69,7 @@ TEST(SchedulerKernelTest, getLws) { } TEST(SchedulerKernelTest, getGws) { - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; MockSchedulerKernel kernel(&program, info, *device); @@ -85,7 +85,7 @@ TEST(SchedulerKernelTest, getGws) { } TEST(SchedulerKernelTest, setGws) { - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; MockSchedulerKernel kernel(&program, info, *device); @@ -98,7 +98,7 @@ TEST(SchedulerKernelTest, setGws) { } TEST(SchedulerKernelTest, getCurbeSize) { - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; uint32_t crossTrheadDataSize = 32; @@ -120,13 +120,13 @@ TEST(SchedulerKernelTest, getCurbeSize) { } TEST(SchedulerKernelTest, setArgsForSchedulerKernel) { - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); program->setDevice(device.get()); unique_ptr info(nullptr); KernelInfo *infoPtr = nullptr; - unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, *device, infoPtr)); + unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr)); info.reset(infoPtr); unique_ptr allocs[9]; @@ -150,14 +150,14 @@ TEST(SchedulerKernelTest, setArgsForSchedulerKernel) { } TEST(SchedulerKernelTest, setArgsForSchedulerKernelWithNullDebugQueue) { - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); program->setDevice(device.get()); unique_ptr info(nullptr); KernelInfo *infoPtr = nullptr; - unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, *device, infoPtr)); + unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr)); info.reset(infoPtr); unique_ptr allocs[9]; @@ -181,14 +181,14 @@ TEST(SchedulerKernelTest, setArgsForSchedulerKernelWithNullDebugQueue) { } TEST(SchedulerKernelTest, givenGraphicsAllocationWithDifferentCpuAndGpuAddressesWhenCallSetArgsThenGpuAddressesAreTaken) { - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); program->setDevice(device.get()); unique_ptr info(nullptr); KernelInfo *infoPtr = nullptr; - auto scheduler = clUniquePtr(MockSchedulerKernel::create(*program, *device, infoPtr)); + auto scheduler = clUniquePtr(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr)); info.reset(infoPtr); unique_ptr allocs[9]; @@ -216,14 +216,14 @@ TEST(SchedulerKernelTest, createKernelReflectionForForcedSchedulerDispatch) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.ForceDispatchScheduler.set(true); - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); program->setDevice(device.get()); unique_ptr info(nullptr); KernelInfo *infoPtr = nullptr; - unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, *device, infoPtr)); + unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr)); info.reset(infoPtr); scheduler->createReflectionSurface(); @@ -235,14 +235,14 @@ TEST(SchedulerKernelTest, createKernelReflectionSecondTimeForForcedSchedulerDisp DebugManagerStateRestore dbgRestorer; DebugManager.flags.ForceDispatchScheduler.set(true); - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); program->setDevice(device.get()); unique_ptr info(nullptr); KernelInfo *infoPtr = nullptr; - unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, *device, infoPtr)); + unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr)); info.reset(infoPtr); scheduler->createReflectionSurface(); @@ -258,14 +258,14 @@ TEST(SchedulerKernelTest, createKernelReflectionForSchedulerDoesNothing) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.ForceDispatchScheduler.set(false); - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); program->setDevice(device.get()); unique_ptr info(nullptr); KernelInfo *infoPtr = nullptr; - unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, *device, infoPtr)); + unique_ptr scheduler = unique_ptr(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr)); info.reset(infoPtr); scheduler->createReflectionSurface(); @@ -274,7 +274,7 @@ TEST(SchedulerKernelTest, createKernelReflectionForSchedulerDoesNothing) { } TEST(SchedulerKernelTest, getCurbeSizeWithNullKernelInfo) { - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; @@ -291,7 +291,7 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableWhenSchedulerKer DebugManagerStateRestore dbgRestorer; DebugManager.flags.SchedulerGWS.set(48); - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; MockSchedulerKernel kernel(&program, info, *device); @@ -304,7 +304,7 @@ TEST(SchedulerKernelTest, givenSimulationModeWhenSchedulerKernelIsCreatedThenGws HardwareInfo hwInfo = *platformDevices[0]; hwInfo.featureTable.ftrSimulationMode = true; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; @@ -320,7 +320,7 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableAndSimulationMod HardwareInfo hwInfo = *platformDevices[0]; hwInfo.featureTable.ftrSimulationMode = true; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); MockProgram program(*device->getExecutionEnvironment()); KernelInfo info; diff --git a/unit_tests/scheduler/scheduler_source_tests.h b/unit_tests/scheduler/scheduler_source_tests.h index 744213a771..a3c3a222df 100644 --- a/unit_tests/scheduler/scheduler_source_tests.h +++ b/unit_tests/scheduler/scheduler_source_tests.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,13 +14,13 @@ class SchedulerSourceTest : public testing::Test { public: void SetUp() override { - pDevice = NEO::MockDevice::createWithNewExecutionEnvironment(nullptr); + pDevice = new MockClDevice{NEO::MockDevice::createWithNewExecutionEnvironment(nullptr)}; } void TearDown() override { delete pDevice; } - NEO::Device *pDevice; + NEO::MockClDevice *pDevice; NEO::MockContext context; template 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 74202c8b9a..bf0b1b078d 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, 0); executionEnvironment->memoryManager = std::make_unique(*executionEnvironment); - device.reset(MockDevice::create(executionEnvironment, 0u)); + device = std::make_unique(MockDevice::create(executionEnvironment, 0u)); device->resetCommandStreamReceiver(mockCsr); ctx.reset(new MockContext); cmdQ.reset(new MockCommandQueue(ctx.get(), device.get(), nullptr)); @@ -119,7 +119,7 @@ struct GlArbSyncEventTest : public ::testing::Test { sharing->pfnGlArbSyncObjectWaitServer = glArbSyncObjectWaitServerMock; } - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr ctx; std::unique_ptr cmdQ; OSInterface *osInterface = nullptr; diff --git a/unit_tests/sharings/gl/gl_sharing_tests.cpp b/unit_tests/sharings/gl/gl_sharing_tests.cpp index 2632051db8..a2648432e9 100644 --- a/unit_tests/sharings/gl/gl_sharing_tests.cpp +++ b/unit_tests/sharings/gl/gl_sharing_tests.cpp @@ -1100,7 +1100,7 @@ HWTEST_F(glSharingTests, givenSyncObjectWhenCreateEventIsCalledThenCreateGLSyncO EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, event); - auto &csr = reinterpret_cast(context.getDevice(0))->getUltCommandStreamReceiver(); + auto &csr = reinterpret_cast(context.getDevice(0))->getUltCommandStreamReceiver(); csr.taskLevel = 123; auto eventObj = castToObject(event); EXPECT_TRUE(eventObj->getCommandType() == CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR); diff --git a/unit_tests/sharings/gl/gl_texture_tests.cpp b/unit_tests/sharings/gl/gl_texture_tests.cpp index 58a5da42c7..fd565ab456 100644 --- a/unit_tests/sharings/gl/gl_texture_tests.cpp +++ b/unit_tests/sharings/gl/gl_texture_tests.cpp @@ -58,7 +58,7 @@ class GlSharingTextureTests : public ::testing::Test { tempMM = new TempMM(*executionEnvironment); executionEnvironment->memoryManager.reset(tempMM); - device.reset(MockDevice::create(executionEnvironment, 0)); + device = std::make_unique(MockDevice::create(executionEnvironment, 0)); clContext = std::make_unique(device.get()); mockGlSharingFunctions = glSharing->sharingFunctions.release(); @@ -80,7 +80,7 @@ class GlSharingTextureTests : public ::testing::Test { ExecutionEnvironment *executionEnvironment; cl_image_desc imgDesc; TempMM *tempMM; - std::unique_ptr device; + std::unique_ptr device; std::unique_ptr clContext; std::unique_ptr glSharing = std::make_unique(); GlSharingFunctionsMock *mockGlSharingFunctions; diff --git a/unit_tests/sharings/sharing_factory_tests.cpp b/unit_tests/sharings/sharing_factory_tests.cpp index 9499572322..4555c2835a 100644 --- a/unit_tests/sharings/sharing_factory_tests.cpp +++ b/unit_tests/sharings/sharing_factory_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -216,9 +216,9 @@ TEST(Context, givenMockSharingBuilderWhenContextWithInvalidPropertiesThenContext stateRestore.clearCurrentState(); stateRestore.registerSharing(SharingType::CLGL_SHARING); - auto device = std::make_unique(); - cl_device_id clDevice = static_cast(device.get()); - auto deviceVector = DeviceVector(&clDevice, 1); + auto device = std::make_unique(new MockDevice); + cl_device_id clDevice = device.get(); + auto deviceVector = ClDeviceVector(&clDevice, 1); cl_int retVal; cl_platform_id platformId[] = {platform()}; diff --git a/unit_tests/sharings/unified/unified_sharing_fixtures.h b/unit_tests/sharings/unified/unified_sharing_fixtures.h index 0dbd4b3224..1473f7f75d 100644 --- a/unit_tests/sharings/unified/unified_sharing_fixtures.h +++ b/unit_tests/sharings/unified/unified_sharing_fixtures.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,9 +17,9 @@ namespace NEO { template struct UnifiedSharingContextFixture : ::testing::Test { void SetUp() override { - device = std::make_unique(); - cl_device_id deviceId = static_cast(device.get()); - deviceVector = std::make_unique(&deviceId, 1); + device = std::make_unique(new MockDevice); + cl_device_id deviceId = device.get(); + deviceVector = std::make_unique(&deviceId, 1); if (validContext) { context = createValidContext(); } else { @@ -47,8 +47,8 @@ struct UnifiedSharingContextFixture : ::testing::Test { return createContext(nullptr); } - std::unique_ptr device; - std::unique_ptr deviceVector; + std::unique_ptr device; + std::unique_ptr deviceVector; std::unique_ptr context; }; diff --git a/unit_tests/sharings/unified/unified_sharing_tests.cpp b/unit_tests/sharings/unified/unified_sharing_tests.cpp index 3faff21560..25392c7148 100644 --- a/unit_tests/sharings/unified/unified_sharing_tests.cpp +++ b/unit_tests/sharings/unified/unified_sharing_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,9 +18,9 @@ using namespace NEO; TEST(UnifiedSharingTests, givenContextCreatedWithExternalDeviceHandlePropertyWhenGettingUnifiedSharingThenReturnIt) { - MockDevice device{}; - cl_device_id deviceId = static_cast(&device); - DeviceVector allDevs(&deviceId, 1); + MockClDevice device{new MockDevice}; + cl_device_id deviceId = &device; + ClDeviceVector allDevs(&deviceId, 1); cl_int retVal{}; const cl_context_properties context_props[] = { diff --git a/unit_tests/sharings/va/context_va_tests.cpp b/unit_tests/sharings/va/context_va_tests.cpp index 56be20ac38..dbb7288d32 100644 --- a/unit_tests/sharings/va/context_va_tests.cpp +++ b/unit_tests/sharings/va/context_va_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -32,7 +32,7 @@ struct VAContextTest : public PlatformFixture, properties[1] = (cl_context_properties)platform; properties[2] = 0; - context = Context::create(properties, DeviceVector(devices, num_devices), nullptr, nullptr, retVal); + context = Context::create(properties, ClDeviceVector(devices, num_devices), nullptr, nullptr, retVal); ASSERT_NE(nullptr, context); } @@ -62,7 +62,7 @@ TEST_F(VAContextTest, GivenVaContextParamWhenCreateContextThenReturnError) { cl_context_properties validProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], CL_CONTEXT_VA_API_DISPLAY_INTEL, 0x10000, 0}; cl_int retVal = CL_SUCCESS; - auto ctx = Context::create(validProperties, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); + auto ctx = Context::create(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal); // not supported by default // use MockVaSharing to test va-sharing functionality diff --git a/unit_tests/sharings/va/va_sharing_tests.cpp b/unit_tests/sharings/va/va_sharing_tests.cpp index 3b1e014eef..ab7856f2c4 100644 --- a/unit_tests/sharings/va/va_sharing_tests.cpp +++ b/unit_tests/sharings/va/va_sharing_tests.cpp @@ -474,8 +474,8 @@ TEST_F(VaSharingTests, givenValidPlatformWhenGetDeviceIdsFromVaApiMediaAdapterCa auto errCode = clGetDeviceIDsFromVA_APIMediaAdapterINTEL(platformId, 0u, nullptr, 0u, 1, &devices, &numDevices); EXPECT_EQ(CL_SUCCESS, errCode); EXPECT_EQ(1u, numDevices); - EXPECT_NE(nullptr, platform()->getDevice(0)); - EXPECT_EQ(platform()->getDevice(0), devices); + EXPECT_NE(nullptr, platform()->getClDevice(0)); + EXPECT_EQ(platform()->getClDevice(0), devices); } TEST_F(VaSharingTests, givenInValidPlatformWhenGetDeviceIdsFromVaApiMediaAdapterCalledThenReturnFirstDevice) { 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 332cff3728..d34471fea0 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -34,13 +34,13 @@ class CommandStreamReceiverWithActiveDebuggerTest : public ::testing::Test { auto mockMemoryManager = new MockMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(mockMemoryManager); - device.reset(Device::create(executionEnvironment, 0)); + device = std::make_unique(Device::create(executionEnvironment, 0)); device->setSourceLevelDebuggerActive(true); return static_cast *>(device->getDefaultEngine().commandStreamReceiver); } - std::unique_ptr device; + std::unique_ptr device; ExecutionEnvironment *executionEnvironment = nullptr; HardwareInfo *hwInfo = nullptr; }; @@ -66,10 +66,10 @@ HWTEST_F(CommandStreamReceiverWithActiveDebuggerTest, givenCsrWithActiveDebugger *heap.get(), 0, dispatchFlags, - *device); + device->getDevice()); auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().platform.eRenderCoreFamily, true); - auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *device).getSipAllocation(); + auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device->getDevice()).getSipAllocation(); bool found = false; for (auto allocation : mockCsr->copyOfAllocations) { if (allocation == sipAllocation) { @@ -106,10 +106,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs *heap.get(), 0, dispatchFlags, - *device); + device->getDevice()); auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().platform.eRenderCoreFamily, true); - auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *device).getSipAllocation(); + auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device->getDevice()).getSipAllocation(); HardwareParse hwParser; hwParser.parseCommands(preambleStream); @@ -157,7 +157,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs *heap.get(), 0, dispatchFlags, - *device); + device->getDevice()); mockCsr->flushBatchedSubmissions(); @@ -168,10 +168,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs *heap.get(), 0, dispatchFlags, - *device); + device->getDevice()); auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().platform.eRenderCoreFamily, true); - auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *device).getSipAllocation(); + auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device->getDevice()).getSipAllocation(); HardwareParse hwParser; hwParser.parseCommands(preambleStream); diff --git a/unit_tests/utilities/file_logger_tests.cpp b/unit_tests/utilities/file_logger_tests.cpp index f27d0d97ec..623137169a 100644 --- a/unit_tests/utilities/file_logger_tests.cpp +++ b/unit_tests/utilities/file_logger_tests.cpp @@ -357,7 +357,7 @@ TEST(FileLogger, WithDebugFunctionalityDontDumpKernelArgsForNullMdi) { TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKernelArgsForMdi) { auto kernelInfo = std::make_unique(); - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); auto kernel = unique_ptr(new MockKernel(&program, *kernelInfo, *device)); auto multiDispatchInfo = unique_ptr(new MockMultiDispatchInfo(kernel.get())); @@ -392,7 +392,7 @@ TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKern TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsForMdi) { auto kernelInfo = std::make_unique(); - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); auto kernel = unique_ptr(new MockKernel(&program, *kernelInfo, *device)); auto multiDispatchInfo = unique_ptr(new MockMultiDispatchInfo(kernel.get())); @@ -437,7 +437,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelNullKernel) { TEST(FileLogger, WithDebugFunctionalityAndEmptyKernelDontDumpKernelArgs) { auto kernelInfo = std::make_unique(); - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); auto kernel = unique_ptr(new MockKernel(&program, *kernelInfo, *device)); @@ -453,7 +453,7 @@ TEST(FileLogger, WithDebugFunctionalityAndEmptyKernelDontDumpKernelArgs) { TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediate) { auto kernelInfo = std::make_unique(); - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); auto kernel = unique_ptr(new MockKernel(&program, *kernelInfo, *device)); @@ -487,7 +487,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediate) { TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediateZeroSize) { auto kernelInfo = std::make_unique(); - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); auto kernel = unique_ptr(new MockKernel(&program, *kernelInfo, *device)); @@ -517,7 +517,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediateZeroSize) { TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsLocalBuffer) { auto kernelInfo = std::make_unique(); - auto device = unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(*device->getExecutionEnvironment()); auto kernel = unique_ptr(new MockKernel(&program, *kernelInfo, *device)); @@ -539,7 +539,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsLocalBuffer) { TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsBufferNotSet) { auto kernelInfo = std::make_unique(); - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device)); @@ -568,7 +568,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsBufferNotSet) { } TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsBuffer) { - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto buffer = BufferHelper<>::create(context.get()); cl_mem clObj = buffer; @@ -610,7 +610,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsBuffer) { TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsSampler) { auto kernelInfo = std::make_unique(); - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device)); @@ -637,7 +637,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsSampler) { TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImageNotSet) { auto kernelInfo = std::make_unique(); - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto context = clUniquePtr(new MockContext(device.get())); auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false)); auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));