From 1dd552d473b0eaca99a5f2ef2e25f5f0546877bb Mon Sep 17 00:00:00 2001 From: Piotr Obst Date: Thu, 13 May 2021 19:46:01 +0200 Subject: [PATCH] Change D3DKMT_CLIENTHINT_OPENCL to _ONEAPI_LEVEL0 in L0 Signed-off-by: Piotr Obst --- level_zero/cmake/l0_tests.cmake | 1 + .../source/helpers/api_specific_config_l0.cpp | 6 +++++- .../unit_tests/os_interface/CMakeLists.txt | 7 +++++++ .../os_interface/windows/CMakeLists.txt | 18 +++++++++++++++++ .../os_interface/windows/wddm_l0_tests.cpp | 20 +++++++++++++++++++ .../unit_tests/sources/helper/CMakeLists.txt | 1 + .../helper/api_specific_config_l0_tests.cpp | 18 +++++++++++++++++ .../helpers/api_specific_config_ocl.cpp | 5 ++++- opencl/test/unit_test/helpers/CMakeLists.txt | 1 + .../helpers/api_specific_config_ocl_tests.cpp | 18 +++++++++++++++++ shared/source/helpers/api_specific_config.h | 5 ++++- .../source/os_interface/windows/wddm/wddm.cpp | 7 ++++++- .../api_specific_config_shared_tests.cpp | 3 +++ 13 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 level_zero/core/test/unit_tests/os_interface/CMakeLists.txt create mode 100644 level_zero/core/test/unit_tests/os_interface/windows/CMakeLists.txt create mode 100644 level_zero/core/test/unit_tests/os_interface/windows/wddm_l0_tests.cpp create mode 100644 level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp create mode 100644 opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp diff --git a/level_zero/cmake/l0_tests.cmake b/level_zero/cmake/l0_tests.cmake index 3eed2cc9d5..f8c24d8cd9 100644 --- a/level_zero/cmake/l0_tests.cmake +++ b/level_zero/cmake/l0_tests.cmake @@ -90,6 +90,7 @@ add_library(compute_runtime_mockable_extra ${NEO_SOURCE_DIR}/opencl/test/unit_test/mocks/mock_memory_manager.cpp ${NEO_SOURCE_DIR}/opencl/test/unit_test/mocks/mock_program.cpp ${NEO_SOURCE_DIR}/opencl/test/unit_test/utilities/debug_settings_reader_creator.cpp + ${NEO_SOURCE_DIR}/opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.cpp ${NEO_SOURCE_DIR}/shared/source/debug_settings/debug_settings_manager.cpp ) diff --git a/level_zero/core/source/helpers/api_specific_config_l0.cpp b/level_zero/core/source/helpers/api_specific_config_l0.cpp index 4a21762917..631a3bf8f8 100644 --- a/level_zero/core/source/helpers/api_specific_config_l0.cpp +++ b/level_zero/core/source/helpers/api_specific_config_l0.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,4 +21,8 @@ bool ApiSpecificConfig::getBindlessConfiguration() { } } +ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() { + return ApiSpecificConfig::L0; +} + } // namespace NEO \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/os_interface/CMakeLists.txt b/level_zero/core/test/unit_tests/os_interface/CMakeLists.txt new file mode 100644 index 0000000000..cef68e2de8 --- /dev/null +++ b/level_zero/core/test/unit_tests/os_interface/CMakeLists.txt @@ -0,0 +1,7 @@ +# +# Copyright (C) 2021 Intel Corporation +# +# SPDX-License-Identifier: MIT +# + +add_subdirectories() diff --git a/level_zero/core/test/unit_tests/os_interface/windows/CMakeLists.txt b/level_zero/core/test/unit_tests/os_interface/windows/CMakeLists.txt new file mode 100644 index 0000000000..13404d6d75 --- /dev/null +++ b/level_zero/core/test/unit_tests/os_interface/windows/CMakeLists.txt @@ -0,0 +1,18 @@ +# +# Copyright (C) 2021 Intel Corporation +# +# SPDX-License-Identifier: MIT +# + +set(NEO_L0_OS_INTERFACE_TESTS_WINDOWS + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_l0_tests.cpp +) + +set_property(GLOBAL PROPERTY NEO_L0_OS_INTERFACE_TESTS_WINDOWS ${NEO_L0_OS_INTERFACE_TESTS_WINDOWS}) + +if(WIN32) + target_sources(${TARGET_NAME} PRIVATE + ${NEO_L0_OS_INTERFACE_TESTS_WINDOWS} + ) +endif() diff --git a/level_zero/core/test/unit_tests/os_interface/windows/wddm_l0_tests.cpp b/level_zero/core/test/unit_tests/os_interface/windows/wddm_l0_tests.cpp new file mode 100644 index 0000000000..2a356ad391 --- /dev/null +++ b/level_zero/core/test/unit_tests/os_interface/windows/wddm_l0_tests.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/test/common/helpers/debug_manager_state_restore.h" + +#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h" +#include "test.h" + +namespace NEO { + +TEST_F(WddmTestWithMockGdiDll, givenWddmWhenContextCreatedThenHintPassedIsOneApiL0) { + init(); + auto createContextParams = getCreateContextDataFcn(); + EXPECT_EQ(D3DKMT_CLIENTHINT_ONEAPI_LEVEL0, createContextParams->ClientHint); +} +} // namespace NEO \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/sources/helper/CMakeLists.txt b/level_zero/core/test/unit_tests/sources/helper/CMakeLists.txt index 0f8f71c8dc..09c326b792 100644 --- a/level_zero/core/test/unit_tests/sources/helper/CMakeLists.txt +++ b/level_zero/core/test/unit_tests/sources/helper/CMakeLists.txt @@ -6,6 +6,7 @@ target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/api_specific_config_l0_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner_l0_tests.cpp ) add_subdirectories() diff --git a/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp new file mode 100644 index 0000000000..8b3887291b --- /dev/null +++ b/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2021 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/helpers/api_specific_config.h" + +#include "gtest/gtest.h" + +namespace NEO { + +TEST(ApiSpecificConfigL0Tests, WhenGettingApiTypeThenCorrectTypeIsReturned) { + EXPECT_EQ(ApiSpecificConfig::L0, ApiSpecificConfig::getApiType()); +} + +} // namespace NEO \ No newline at end of file diff --git a/opencl/source/helpers/api_specific_config_ocl.cpp b/opencl/source/helpers/api_specific_config_ocl.cpp index 2eb0d8c69e..e642cf0ae2 100644 --- a/opencl/source/helpers/api_specific_config_ocl.cpp +++ b/opencl/source/helpers/api_specific_config_ocl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,4 +19,7 @@ bool ApiSpecificConfig::getBindlessConfiguration() { return false; } } +ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() { + return ApiSpecificConfig::OCL; +} } // namespace NEO \ No newline at end of file diff --git a/opencl/test/unit_test/helpers/CMakeLists.txt b/opencl/test/unit_test/helpers/CMakeLists.txt index 05631533f5..7930f90905 100644 --- a/opencl/test/unit_test/helpers/CMakeLists.txt +++ b/opencl/test/unit_test/helpers/CMakeLists.txt @@ -6,6 +6,7 @@ set(IGDRCL_SRCS_tests_helpers ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/api_specific_config_ocl_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/base_object_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cl_helper_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cmd_buffer_validator.h diff --git a/opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp b/opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp new file mode 100644 index 0000000000..507626670f --- /dev/null +++ b/opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2021 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/helpers/api_specific_config.h" + +#include "gtest/gtest.h" + +namespace NEO { + +TEST(ApiSpecificConfigOclTests, WhenGettingApiTypeThenCorrectTypeIsReturned) { + EXPECT_EQ(ApiSpecificConfig::OCL, ApiSpecificConfig::getApiType()); +} + +} // namespace NEO \ No newline at end of file diff --git a/shared/source/helpers/api_specific_config.h b/shared/source/helpers/api_specific_config.h index 2a9f555b46..67d188f2a5 100644 --- a/shared/source/helpers/api_specific_config.h +++ b/shared/source/helpers/api_specific_config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,7 +8,10 @@ #pragma once namespace NEO { struct ApiSpecificConfig { + enum ApiType { OCL, + L0 }; static bool getHeapConfiguration(); static bool getBindlessConfiguration(); + static ApiType getApiType(); }; } // namespace NEO \ No newline at end of file diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index b7431bfb25..4b31386849 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -14,6 +14,7 @@ #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/page_table_mngr.h" #include "shared/source/gmm_helper/resource_info.h" +#include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/heap_assigner.h" #include "shared/source/helpers/interlocked_max.h" #include "shared/source/helpers/windows/gmm_callbacks.h" @@ -839,7 +840,11 @@ bool Wddm::createContext(OsContextWin &osContext) { CreateContext.pPrivateDriverData = &PrivateData; } CreateContext.NodeOrdinal = WddmEngineMapper::engineNodeMap(osContext.getEngineType()); - CreateContext.ClientHint = D3DKMT_CLIENTHINT_OPENCL; + if (ApiSpecificConfig::getApiType() == ApiSpecificConfig::L0) { + CreateContext.ClientHint = D3DKMT_CLIENTHINT_ONEAPI_LEVEL0; + } else { + CreateContext.ClientHint = D3DKMT_CLIENTHINT_OPENCL; + } CreateContext.hDevice = device; status = getGdi()->createContext(&CreateContext); diff --git a/shared/test/common/helpers/api_specific_config_shared_tests.cpp b/shared/test/common/helpers/api_specific_config_shared_tests.cpp index 39efe9d5ae..4a7a5da4b6 100644 --- a/shared/test/common/helpers/api_specific_config_shared_tests.cpp +++ b/shared/test/common/helpers/api_specific_config_shared_tests.cpp @@ -19,4 +19,7 @@ bool ApiSpecificConfig::getBindlessConfiguration() { return false; } } +ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() { + return ApiSpecificConfig::OCL; +} } // namespace NEO \ No newline at end of file