From 1703022d039b8605a032a203b1a93c168c679a25 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Sun, 28 Jul 2024 01:57:03 -0700 Subject: [PATCH 1/9] Rename UrImage.hpp -> MockDeviceImage.hpp --- sycl/unittests/Extensions/DeviceGlobal.cpp | 2 +- sycl/unittests/Extensions/USMMemcpy2D.cpp | 2 +- sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp | 2 +- sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp | 2 +- sycl/unittests/SYCL2020/IsCompatible.cpp | 2 +- sycl/unittests/SYCL2020/KernelBundle.cpp | 2 +- sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp | 2 +- sycl/unittests/SYCL2020/KernelID.cpp | 2 +- sycl/unittests/SYCL2020/SpecializationConstant.cpp | 2 +- sycl/unittests/accessor/AccessorPlaceholder.cpp | 2 +- sycl/unittests/assert/assert.cpp | 2 +- sycl/unittests/buffer/KernelArgMemObj.cpp | 2 +- sycl/unittests/helpers/{UrImage.hpp => MockDeviceImage.hpp} | 0 sycl/unittests/helpers/TestKernel.hpp | 2 +- sycl/unittests/kernel-and-program/Cache.cpp | 2 +- sycl/unittests/kernel-and-program/KernelBuildOptions.cpp | 2 +- sycl/unittests/kernel-and-program/MultipleDevsCache.cpp | 2 +- sycl/unittests/kernel-and-program/OutOfResources.cpp | 2 +- sycl/unittests/pipes/host_pipe_registration.cpp | 2 +- sycl/unittests/program_manager/BuildLog.cpp | 2 +- sycl/unittests/program_manager/DynamicLinking.cpp | 2 +- sycl/unittests/program_manager/SubDevices.cpp | 2 +- sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp | 2 +- sycl/unittests/program_manager/itt_annotations.cpp | 2 +- .../program_manager/passing_link_and_compile_options.cpp | 2 +- sycl/unittests/queue/GetProfilingInfo.cpp | 2 +- sycl/unittests/scheduler/CommandsWaitForEvents.cpp | 2 +- sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp | 2 +- sycl/unittests/scheduler/RequiredWGSize.cpp | 2 +- sycl/unittests/stream/stream.cpp | 2 +- sycl/unittests/windows/dllmain.cpp | 2 +- 31 files changed, 30 insertions(+), 30 deletions(-) rename sycl/unittests/helpers/{UrImage.hpp => MockDeviceImage.hpp} (100%) diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index ee59cb4dc2d84..3f03000cfb1f4 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -12,7 +12,7 @@ #include "detail/kernel_program_cache.hpp" #include -#include +#include #include #include diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index 18d45736e54cb..b309bde7ac1a9 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index 8ec091e099f8a..4f73e9e1e5ba1 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp b/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp index 42ff1c6eceabf..a77d6660cf6cc 100644 --- a/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp +++ b/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include #include diff --git a/sycl/unittests/SYCL2020/IsCompatible.cpp b/sycl/unittests/SYCL2020/IsCompatible.cpp index aaa295bf77b2f..4d3c6ccac4658 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index 9829f746ac819..ce534f128de70 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp index 897ff6aba4f4d..d4b805453dab0 100644 --- a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp +++ b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index 21e458864549a..2d3a912f0aad1 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 9875084a3ed92..3f65722950c91 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/accessor/AccessorPlaceholder.cpp b/sycl/unittests/accessor/AccessorPlaceholder.cpp index 045ae6402d22e..fbc1b26bbc07f 100644 --- a/sycl/unittests/accessor/AccessorPlaceholder.cpp +++ b/sycl/unittests/accessor/AccessorPlaceholder.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 33048f3433932..8cffd2165ee80 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/buffer/KernelArgMemObj.cpp b/sycl/unittests/buffer/KernelArgMemObj.cpp index ba9b9c9b1001e..891a5b4e27c14 100644 --- a/sycl/unittests/buffer/KernelArgMemObj.cpp +++ b/sycl/unittests/buffer/KernelArgMemObj.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include class TestKernelWithMemObj; diff --git a/sycl/unittests/helpers/UrImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp similarity index 100% rename from sycl/unittests/helpers/UrImage.hpp rename to sycl/unittests/helpers/MockDeviceImage.hpp diff --git a/sycl/unittests/helpers/TestKernel.hpp b/sycl/unittests/helpers/TestKernel.hpp index cea2acba20db5..3f4cd5bf261d0 100644 --- a/sycl/unittests/helpers/TestKernel.hpp +++ b/sycl/unittests/helpers/TestKernel.hpp @@ -9,7 +9,7 @@ #pragma once #include "MockKernelInfo.hpp" -#include "UrImage.hpp" +#include "MockDeviceImage.hpp" template class TestKernel; diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index c2ddb46c3a17f..ff1631b7ea150 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -15,7 +15,7 @@ #include "detail/kernel_program_cache.hpp" #include "sycl/detail/ur.hpp" #include -#include +#include #include #include diff --git a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp index 2fb0d69da97b9..ed2791202fa14 100644 --- a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp +++ b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp @@ -12,7 +12,7 @@ #endif #include -#include +#include #include #include diff --git a/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp b/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp index 5bcbc3150abef..25d9c7b2918ad 100644 --- a/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp +++ b/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp @@ -12,7 +12,7 @@ #include "detail/kernel_bundle_impl.hpp" #include "detail/kernel_program_cache.hpp" #include -#include +#include #include #include diff --git a/sycl/unittests/kernel-and-program/OutOfResources.cpp b/sycl/unittests/kernel-and-program/OutOfResources.cpp index c249e6599ec5a..6cda88f10da02 100644 --- a/sycl/unittests/kernel-and-program/OutOfResources.cpp +++ b/sycl/unittests/kernel-and-program/OutOfResources.cpp @@ -12,7 +12,7 @@ #include "detail/kernel_bundle_impl.hpp" #include "detail/kernel_program_cache.hpp" #include -#include +#include #include #include diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index b625b9f5fc5cc..1087e854ba379 100644 --- a/sycl/unittests/pipes/host_pipe_registration.cpp +++ b/sycl/unittests/pipes/host_pipe_registration.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/unittests/program_manager/BuildLog.cpp b/sycl/unittests/program_manager/BuildLog.cpp index fc4ff8abbbde2..1c28d8e3d6003 100644 --- a/sycl/unittests/program_manager/BuildLog.cpp +++ b/sycl/unittests/program_manager/BuildLog.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/unittests/program_manager/DynamicLinking.cpp b/sycl/unittests/program_manager/DynamicLinking.cpp index c8c9b101baf9e..0acdd4344f163 100644 --- a/sycl/unittests/program_manager/DynamicLinking.cpp +++ b/sycl/unittests/program_manager/DynamicLinking.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/program_manager/SubDevices.cpp b/sycl/unittests/program_manager/SubDevices.cpp index 26d5b4cf148a0..759b35190bbf6 100644 --- a/sycl/unittests/program_manager/SubDevices.cpp +++ b/sycl/unittests/program_manager/SubDevices.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include #include diff --git a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp index 5eb6fdb7e8f4e..1069dd7131efd 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/program_manager/itt_annotations.cpp b/sycl/unittests/program_manager/itt_annotations.cpp index edcb9a9baf88b..05945b63f7314 100644 --- a/sycl/unittests/program_manager/itt_annotations.cpp +++ b/sycl/unittests/program_manager/itt_annotations.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp index 893e8bdb41ee7..4d5ec4e26f851 100644 --- a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp +++ b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/queue/GetProfilingInfo.cpp b/sycl/unittests/queue/GetProfilingInfo.cpp index d74702c2f85d8..a37b399f725ce 100644 --- a/sycl/unittests/queue/GetProfilingInfo.cpp +++ b/sycl/unittests/queue/GetProfilingInfo.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index fdada9b624714..8ea3f6a9c4f48 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -10,7 +10,7 @@ #include "SchedulerTestUtils.hpp" #include "ur_mock_helpers.hpp" #include -#include +#include #include #include diff --git a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp index c37753735c658..02316fc1549c1 100644 --- a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp +++ b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp @@ -10,7 +10,7 @@ #include "SchedulerTestUtils.hpp" #include -#include +#include #include #include diff --git a/sycl/unittests/scheduler/RequiredWGSize.cpp b/sycl/unittests/scheduler/RequiredWGSize.cpp index 3cfa1958ed524..e62da1134b1b1 100644 --- a/sycl/unittests/scheduler/RequiredWGSize.cpp +++ b/sycl/unittests/scheduler/RequiredWGSize.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/stream/stream.cpp b/sycl/unittests/stream/stream.cpp index 0811abff8cf77..a075a8eb0f573 100644 --- a/sycl/unittests/stream/stream.cpp +++ b/sycl/unittests/stream/stream.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include #include diff --git a/sycl/unittests/windows/dllmain.cpp b/sycl/unittests/windows/dllmain.cpp index f99364fe11720..de08aeab30a97 100644 --- a/sycl/unittests/windows/dllmain.cpp +++ b/sycl/unittests/windows/dllmain.cpp @@ -12,7 +12,7 @@ * distinct binary executable. */ -#include +#include #include #include From e26e38c419900370e65dd5719c0da34e263cf276 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Sun, 28 Jul 2024 02:21:54 -0700 Subject: [PATCH 2/9] Rename UrImage -> MockDeviceImage --- sycl/unittests/Extensions/DeviceGlobal.cpp | 38 ++++++------ sycl/unittests/Extensions/USMMemcpy2D.cpp | 20 +++---- .../VirtualFunctions/RuntimeLinking.cpp | 8 +-- sycl/unittests/SYCL2020/IsCompatible.cpp | 23 ++++---- sycl/unittests/SYCL2020/KernelBundle.cpp | 20 +++---- .../SYCL2020/KernelBundleStateFiltering.cpp | 20 +++---- sycl/unittests/SYCL2020/KernelID.cpp | 20 +++---- .../SYCL2020/SpecializationConstant.cpp | 20 +++---- sycl/unittests/assert/assert.cpp | 38 ++++++------ sycl/unittests/buffer/KernelArgMemObj.cpp | 4 +- sycl/unittests/helpers/MockDeviceImage.hpp | 58 ++++++++++--------- sycl/unittests/helpers/TestKernel.hpp | 4 +- sycl/unittests/kernel-and-program/Cache.cpp | 20 +++---- .../kernel-and-program/KernelBuildOptions.cpp | 20 +++---- .../kernel-and-program/MultipleDevsCache.cpp | 4 +- .../kernel-and-program/OutOfResources.cpp | 4 +- .../pipes/host_pipe_registration.cpp | 20 +++---- .../program_manager/DynamicLinking.cpp | 8 +-- .../arg_mask/EliminatedArgMask.cpp | 40 ++++++------- .../passing_link_and_compile_options.cpp | 28 ++++----- sycl/unittests/queue/GetProfilingInfo.cpp | 24 ++++---- .../scheduler/CommandsWaitForEvents.cpp | 20 +++---- 22 files changed, 234 insertions(+), 227 deletions(-) diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index 3f03000cfb1f4..5f800fe03a355 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -53,7 +53,7 @@ struct KernelInfo } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateDeviceGlobalImage() { +static sycl::unittest::MockDeviceImage generateDeviceGlobalImage() { using namespace sycl::unittest; // Call device global map initializer explicitly to mimic the integration @@ -72,18 +72,18 @@ static sycl::unittest::UrImage generateDeviceGlobalImage() { UrArray Entries = makeEmptyKernels({DeviceGlobalTestKernelName}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage generateDeviceGlobalImgScopeImage() { +static sycl::unittest::MockDeviceImage generateDeviceGlobalImgScopeImage() { using namespace sycl::unittest; // Call device global map initializer explicitly to mimic the integration @@ -103,21 +103,21 @@ static sycl::unittest::UrImage generateDeviceGlobalImgScopeImage() { UrArray Entries = makeEmptyKernels({DeviceGlobalImgScopeTestKernelName}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } namespace { -sycl::unittest::UrImage Imgs[] = {generateDeviceGlobalImage(), - generateDeviceGlobalImgScopeImage()}; -sycl::unittest::UrImageArray<2> ImgArray{Imgs}; +sycl::unittest::MockDeviceImage Imgs[] = {generateDeviceGlobalImage(), + generateDeviceGlobalImgScopeImage()}; +sycl::unittest::MockDeviceImageArray<2> ImgArray{Imgs}; // Trackers. thread_local DeviceGlobalElemType MockDeviceGlobalMem; diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index b309bde7ac1a9..35791e50975da 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -125,7 +125,7 @@ struct KernelInfo> } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateMemopsImage() { +static sycl::unittest::MockDeviceImage generateMemopsImage() { using namespace sycl::unittest; UrPropertySet PropSet; @@ -136,20 +136,20 @@ static sycl::unittest::UrImage generateMemopsImage() { {USMFillHelperKernelNameLong, USMFillHelperKernelNameChar, USMMemcpyHelperKernelNameLong, USMMemcpyHelperKernelNameChar}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } namespace { -sycl::unittest::UrImage Imgs[] = {generateMemopsImage()}; -sycl::unittest::UrImageArray<1> ImgArray{Imgs}; +sycl::unittest::MockDeviceImage Imgs[] = {generateMemopsImage()}; +sycl::unittest::MockDeviceImageArray<1> ImgArray{Imgs}; ur_context_info_t LastMemopsQuery = UR_CONTEXT_INFO_NUM_DEVICES; diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index 4f73e9e1e5ba1..eb17af64027f9 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -46,7 +46,7 @@ KERNEL_INFO(KernelG) } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage +static sycl::unittest::MockDeviceImage generateImage(std::initializer_list KernelNames, const std::string &VFSets, bool UsesVFSets, unsigned char Magic) { sycl::unittest::UrPropertySet PropSet; @@ -72,7 +72,7 @@ generateImage(std::initializer_list KernelNames, sycl::unittest::UrArray Entries = sycl::unittest::makeEmptyKernels(KernelNames); - sycl::unittest::UrImage Img{ + sycl::unittest::MockDeviceImage Img{ SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec "", // Compile options @@ -103,7 +103,7 @@ static constexpr unsigned PROGRAM_F1 = 53; // Device images with no entires are ignored by SYCL RT during registration. // Therefore, we have to provide some kernel names to make the test work, even // if we don't really have them/use them. -static sycl::unittest::UrImage Imgs[] = { +static sycl::unittest::MockDeviceImage Imgs[] = { generateImage({"KernelA"}, "set-a", /* uses vf set */ true, PROGRAM_A), generateImage({"DummyKernel0"}, "set-a", /* provides vf set */ false, PROGRAM_A0), @@ -131,7 +131,7 @@ static sycl::unittest::UrImage Imgs[] = { generateImage({"KernelG"}, "set-f", /* uses vf set */ true, PROGRAM_F1)}; // Registers mock devices images in the SYCL RT -static sycl::unittest::UrImageArray<15> ImgArray{Imgs}; +static sycl::unittest::MockDeviceImageArray<15> ImgArray{Imgs}; TEST(VirtualFunctions, SingleKernelUsesSingleVFSet) { sycl::unittest::UrMock<> Mock; diff --git a/sycl/unittests/SYCL2020/IsCompatible.cpp b/sycl/unittests/SYCL2020/IsCompatible.cpp index 4d3c6ccac4658..a8f82f58a8a5f 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -22,9 +22,10 @@ MOCK_INTEGRATION_HEADER(TestKernelCPUValidReqdWGSize3D) MOCK_INTEGRATION_HEADER(TestKernelGPU) MOCK_INTEGRATION_HEADER(TestKernelACC) -static sycl::unittest::UrImage +static sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list KernelNames, - const std::vector &Aspects, const std::vector &ReqdWGSize = {}) { + const std::vector &Aspects, + const std::vector &ReqdWGSize = {}) { using namespace sycl::unittest; UrPropertySet PropSet; @@ -34,18 +35,18 @@ generateDefaultImage(std::initializer_list KernelNames, UrArray Entries = makeEmptyKernels(KernelNames); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage Imgs[7] = { +static sycl::unittest::MockDeviceImage Imgs[7] = { // Images for validating checks based on max_work_group_size + aspects generateDefaultImage({"TestKernelCPU"}, {sycl::aspect::cpu}, {32}), // 32 <= 256 (OK) @@ -64,7 +65,7 @@ static sycl::unittest::UrImage Imgs[7] = { generateDefaultImage({"TestKernelGPU"}, {sycl::aspect::gpu}), generateDefaultImage({"TestKernelACC"}, {sycl::aspect::accelerator})}; -static sycl::unittest::UrImageArray<7> ImgArray{Imgs}; +static sycl::unittest::MockDeviceImageArray<7> ImgArray{Imgs}; static ur_result_t redefinedDeviceGetInfoCPU(void *pParams) { auto params = *static_cast(pParams); diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index ce534f128de70..28aa39a6713bf 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -24,7 +24,7 @@ MOCK_INTEGRATION_HEADER(TestKernel) MOCK_INTEGRATION_HEADER(TestKernelExeOnly) MOCK_INTEGRATION_HEADER(TestKernelWithAspects) -static sycl::unittest::UrImage +static sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list KernelNames, sycl_device_binary_type BinaryType, const char *DeviceTargetSpec, @@ -39,18 +39,18 @@ generateDefaultImage(std::initializer_list KernelNames, UrArray Entries = makeEmptyKernels(KernelNames); - UrImage Img{BinaryType, // Format - DeviceTargetSpec, - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{BinaryType, // Format + DeviceTargetSpec, + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage Imgs[] = { +static sycl::unittest::MockDeviceImage Imgs[] = { generateDefaultImage({"TestKernel"}, SYCL_DEVICE_BINARY_TYPE_SPIRV, __SYCL_DEVICE_BINARY_TARGET_SPIRV64), generateDefaultImage({"TestKernelExeOnly"}, SYCL_DEVICE_BINARY_TYPE_NATIVE, @@ -61,7 +61,7 @@ static sycl::unittest::UrImage Imgs[] = { generateDefaultImage( {"TestKernelWithAspects"}, SYCL_DEVICE_BINARY_TYPE_NATIVE, __SYCL_DEVICE_BINARY_TARGET_SPIRV64, {sycl::aspect::gpu})}; -static sycl::unittest::UrImageArray ImgArray{Imgs}; +static sycl::unittest::MockDeviceImageArray ImgArray{Imgs}; static ur_result_t redefinedDeviceGetInfoCPU(void *pParams) { auto params = *static_cast(pParams); diff --git a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp index d4b805453dab0..cec11eb4fdffc 100644 --- a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp +++ b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp @@ -35,7 +35,7 @@ MOCK_INTEGRATION_HEADER(KernelE) namespace { std::set TrackedImages; -sycl::unittest::UrImage +sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list KernelNames, sycl_device_binary_type BinaryType, const char *DeviceTargetSpec) { @@ -48,13 +48,13 @@ generateDefaultImage(std::initializer_list KernelNames, UrArray Entries = makeEmptyKernels(KernelNames); - UrImage Img{BinaryType, // Format - DeviceTargetSpec, - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{BinaryType, // Format + DeviceTargetSpec, + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; const void *BinaryPtr = Img.getBinaryPtr(); TrackedImages.insert(BinaryPtr); @@ -69,7 +69,7 @@ generateDefaultImage(std::initializer_list KernelNames, // Image 5: input, KernelE // Image 6: exe, KernelE // Image 7: exe. KernelE -sycl::unittest::UrImage Imgs[] = { +sycl::unittest::MockDeviceImage Imgs[] = { generateDefaultImage({"KernelA", "KernelB"}, SYCL_DEVICE_BINARY_TYPE_SPIRV, __SYCL_DEVICE_BINARY_TARGET_SPIRV64), generateDefaultImage({"KernelA"}, SYCL_DEVICE_BINARY_TYPE_NATIVE, @@ -87,7 +87,7 @@ sycl::unittest::UrImage Imgs[] = { generateDefaultImage({"KernelE"}, SYCL_DEVICE_BINARY_TYPE_NATIVE, __SYCL_DEVICE_BINARY_TARGET_SPIRV64_X86_64)}; -sycl::unittest::UrImageArray ImgArray{Imgs}; +sycl::unittest::MockDeviceImageArray ImgArray{Imgs}; std::vector UsedImageIndices; void redefinedUrProgramCreateCommon(const void *bin) { diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index 2d3a912f0aad1..6986900f842bc 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -47,7 +47,7 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage +static sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list Kernels) { using namespace sycl::unittest; @@ -57,23 +57,23 @@ generateDefaultImage(std::initializer_list Kernels) { UrArray Entries = makeEmptyKernels(Kernels); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage Imgs[2] = { +static sycl::unittest::MockDeviceImage Imgs[2] = { generateDefaultImage({"KernelID_TestKernel1", "KernelID_TestKernel3"}), generateDefaultImage( {"KernelID_TestKernel2", "_ZTSN2cl4sycl6detail23__sycl_service_kernel__14ServiceKernel1"})}; -static sycl::unittest::UrImageArray<2> ImgArray{Imgs}; +static sycl::unittest::MockDeviceImageArray<2> ImgArray{Imgs}; TEST(KernelID, AllProgramKernelIds) { std::vector AllKernelIDs = sycl::get_kernel_ids(); diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 3f65722950c91..1b422dabb2345 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -37,7 +37,7 @@ template <> const char *get_spec_constant_symbolic_ID() { } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateImageWithSpecConsts() { +static sycl::unittest::MockDeviceImage generateImageWithSpecConsts() { using namespace sycl::unittest; std::vector SpecConstData; @@ -51,19 +51,19 @@ static sycl::unittest::UrImage generateImageWithSpecConsts() { UrArray Entries = makeEmptyKernels({"SpecializationConstant_TestKernel"}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage Img = generateImageWithSpecConsts(); -static sycl::unittest::UrImageArray<1> ImgArray{&Img}; +static sycl::unittest::MockDeviceImage Img = generateImageWithSpecConsts(); +static sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; TEST(SpecializationConstant, DefaultValuesAreSet) { sycl::unittest::UrMock<> Mock; diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 8cffd2165ee80..770d2b4d07f00 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -73,7 +73,7 @@ struct KernelInfo<::sycl::detail::__sycl_service_kernel__::AssertInfoCopier> } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; static const std::string KernelName = "TestKernel"; @@ -88,18 +88,18 @@ static sycl::unittest::UrImage generateDefaultImage() { UrArray Entries = makeEmptyKernels({KernelName}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage generateCopierKernelImage() { +static sycl::unittest::MockDeviceImage generateCopierKernelImage() { using namespace sycl::unittest; static const std::string CopierKernelName = @@ -111,20 +111,20 @@ static sycl::unittest::UrImage generateCopierKernelImage() { UrArray Entries = makeEmptyKernels({CopierKernelName}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -sycl::unittest::UrImage Imgs[] = {generateDefaultImage(), - generateCopierKernelImage()}; -sycl::unittest::UrImageArray<2> ImgArray{Imgs}; +sycl::unittest::MockDeviceImage Imgs[] = {generateDefaultImage(), + generateCopierKernelImage()}; +sycl::unittest::MockDeviceImageArray<2> ImgArray{Imgs}; struct AssertHappened { int Flag = 0; diff --git a/sycl/unittests/buffer/KernelArgMemObj.cpp b/sycl/unittests/buffer/KernelArgMemObj.cpp index 891a5b4e27c14..57b25980ff03b 100644 --- a/sycl/unittests/buffer/KernelArgMemObj.cpp +++ b/sycl/unittests/buffer/KernelArgMemObj.cpp @@ -33,9 +33,9 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage Img = +static sycl::unittest::MockDeviceImage Img = sycl::unittest::generateDefaultImage({"TestKernelWithMemObj"}); -static sycl::unittest::UrImageArray<1> ImgArray{&Img}; +static sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; using namespace sycl; diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index 566817d7ef375..aa0dfabe6931f 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -1,4 +1,5 @@ -//==------------- UrImage.hpp --- UR mock image unit testing library -------==// +//==------------- MockDeviceImage.hpp --- UR mock image unit testing library +//-------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -222,14 +223,16 @@ class UrPropertySet { /// Convenience wrapper around UR internal structures, that manages UR binary /// image data lifecycle. -class UrImage { +class MockDeviceImage { public: /// Constructs an arbitrary device image. - UrImage(uint16_t Version, uint8_t Kind, uint8_t Format, - const std::string &DeviceTargetSpec, - const std::string &CompileOptions, const std::string &LinkOptions, - std::vector Manifest, std::vector Binary, - UrArray OffloadEntries, UrPropertySet PropertySet) + MockDeviceImage(uint16_t Version, uint8_t Kind, uint8_t Format, + const std::string &DeviceTargetSpec, + const std::string &CompileOptions, + const std::string &LinkOptions, std::vector Manifest, + std::vector Binary, + UrArray OffloadEntries, + UrPropertySet PropertySet) : MVersion(Version), MKind(Kind), MFormat(Format), MDeviceTargetSpec(DeviceTargetSpec), MCompileOptions(CompileOptions), MLinkOptions(LinkOptions), MManifest(std::move(Manifest)), @@ -237,14 +240,17 @@ class UrImage { MPropertySet(std::move(PropertySet)) {} /// Constructs a SYCL device image of the latest version. - UrImage(uint8_t Format, const std::string &DeviceTargetSpec, - const std::string &CompileOptions, const std::string &LinkOptions, - std::vector Binary, - UrArray OffloadEntries, UrPropertySet PropertySet) - : UrImage(SYCL_DEVICE_BINARY_VERSION, - SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, Format, DeviceTargetSpec, - CompileOptions, LinkOptions, {}, std::move(Binary), - std::move(OffloadEntries), std::move(PropertySet)) {} + MockDeviceImage(uint8_t Format, const std::string &DeviceTargetSpec, + const std::string &CompileOptions, + const std::string &LinkOptions, + std::vector Binary, + UrArray OffloadEntries, + UrPropertySet PropertySet) + : MockDeviceImage(SYCL_DEVICE_BINARY_VERSION, + SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, Format, + DeviceTargetSpec, CompileOptions, LinkOptions, {}, + std::move(Binary), std::move(OffloadEntries), + std::move(PropertySet)) {} sycl_device_binary_struct convertToNativeType() { return sycl_device_binary_struct{ @@ -281,11 +287,11 @@ class UrImage { /// Convenience wrapper around sycl_device_binaries_struct, that manages mock /// device images' lifecycle. -template class UrImageArray { +template class MockDeviceImageArray { public: static constexpr size_t NumberOfImages = __NumberOfImages; - UrImageArray(UrImage *Imgs) { + MockDeviceImageArray(MockDeviceImage *Imgs) { for (size_t Idx = 0; Idx < NumberOfImages; ++Idx) MNativeImages[Idx] = Imgs[Idx].convertToNativeType(); @@ -300,7 +306,7 @@ template class UrImageArray { __sycl_register_lib(&MAllBinaries); } - ~UrImageArray() { __sycl_unregister_lib(&MAllBinaries); } + ~MockDeviceImageArray() { __sycl_unregister_lib(&MAllBinaries); } private: sycl_device_binary_struct MNativeImages[NumberOfImages]; @@ -537,7 +543,7 @@ addDeviceRequirementsProps(UrPropertySet &Props, Props.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS, std::move(Value)); } -inline UrImage +inline MockDeviceImage generateDefaultImage(std::initializer_list KernelNames) { UrPropertySet PropSet; @@ -545,13 +551,13 @@ generateDefaultImage(std::initializer_list KernelNames) { UrArray Entries = makeEmptyKernels(KernelNames); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } diff --git a/sycl/unittests/helpers/TestKernel.hpp b/sycl/unittests/helpers/TestKernel.hpp index 3f4cd5bf261d0..3ee2ad5833ec8 100644 --- a/sycl/unittests/helpers/TestKernel.hpp +++ b/sycl/unittests/helpers/TestKernel.hpp @@ -33,6 +33,6 @@ struct KernelInfo> } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage Img = +static sycl::unittest::MockDeviceImage Img = sycl::unittest::generateDefaultImage({"TestKernel"}); -static sycl::unittest::UrImageArray<1> ImgArray{&Img}; +static sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index ff1631b7ea150..c6bdd18a8cf1c 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -50,7 +50,7 @@ template <> const char *get_spec_constant_symbolic_ID() { } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; std::vector SpecConstData; @@ -64,19 +64,19 @@ static sycl::unittest::UrImage generateDefaultImage() { UrArray Entries = makeEmptyKernels({"CacheTestKernel", "CacheTestKernel2"}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage Img = generateDefaultImage(); -static sycl::unittest::UrImageArray<1> ImgArray{&Img}; +static sycl::unittest::MockDeviceImage Img = generateDefaultImage(); +static sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; struct TestCtx { ur_context_handle_t context; diff --git a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp index ed2791202fa14..66d5bf850cf77 100644 --- a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp +++ b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp @@ -71,7 +71,7 @@ static void setupCommonMockAPIs(sycl::unittest::UrMock<> &Mock) { &redefinedProgramBuild); } -static sycl::unittest::UrImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; UrPropertySet PropSet; @@ -80,19 +80,19 @@ static sycl::unittest::UrImage generateDefaultImage() { UrArray Entries = makeEmptyKernels({"BuildOptsTestKernel"}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "-compile-img", // Compile options - "-link-img", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "-compile-img", // Compile options + "-link-img", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -sycl::unittest::UrImage Img = generateDefaultImage(); -sycl::unittest::UrImageArray<1> ImgArray{&Img}; +sycl::unittest::MockDeviceImage Img = generateDefaultImage(); +sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; TEST(KernelBuildOptions, KernelBundleBasic) { sycl::unittest::UrMock<> Mock; diff --git a/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp b/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp index 25d9c7b2918ad..7d89ae0f73b3e 100644 --- a/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp +++ b/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp @@ -25,9 +25,9 @@ class MultipleDevsCacheTestKernel; MOCK_INTEGRATION_HEADER(MultipleDevsCacheTestKernel) -static sycl::unittest::UrImage Img = +static sycl::unittest::MockDeviceImage Img = sycl::unittest::generateDefaultImage({"MultipleDevsCacheTestKernel"}); -static sycl::unittest::UrImageArray<1> ImgArray{&Img}; +static sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; static ur_result_t redefinedDeviceGetAfter(void *pParams) { auto params = *static_cast(pParams); diff --git a/sycl/unittests/kernel-and-program/OutOfResources.cpp b/sycl/unittests/kernel-and-program/OutOfResources.cpp index 6cda88f10da02..31ef5b9a979ee 100644 --- a/sycl/unittests/kernel-and-program/OutOfResources.cpp +++ b/sycl/unittests/kernel-and-program/OutOfResources.cpp @@ -27,11 +27,11 @@ class OutOfResourcesKernel2; MOCK_INTEGRATION_HEADER(OutOfResourcesKernel1) MOCK_INTEGRATION_HEADER(OutOfResourcesKernel2) -static sycl::unittest::UrImage Img[2] = { +static sycl::unittest::MockDeviceImage Img[2] = { sycl::unittest::generateDefaultImage({"OutOfResourcesKernel1"}), sycl::unittest::generateDefaultImage({"OutOfResourcesKernel2"})}; -static sycl::unittest::UrImageArray<2> ImgArray{Img}; +static sycl::unittest::MockDeviceImageArray<2> ImgArray{Img}; static int nProgramCreate = 0; static volatile bool outOfResourcesToggle = false; diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index 1087e854ba379..e70535c6b5d9e 100644 --- a/sycl/unittests/pipes/host_pipe_registration.cpp +++ b/sycl/unittests/pipes/host_pipe_registration.cpp @@ -29,7 +29,7 @@ class PipeID; using Pipe = sycl::ext::intel::experimental::pipe; -static sycl::unittest::UrImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; sycl::detail::host_pipe_map::add(Pipe::get_host_ptr(), @@ -45,13 +45,13 @@ static sycl::unittest::UrImage generateDefaultImage() { UrArray Entries = makeEmptyKernels({"TestKernel"}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } @@ -123,8 +123,8 @@ class PipeTest : public ::testing::Test { queue q; }; -static sycl::unittest::UrImage Img = generateDefaultImage(); -static sycl::unittest::UrImageArray<1> ImgArray{&Img}; +static sycl::unittest::MockDeviceImage Img = generateDefaultImage(); +static sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; TEST_F(PipeTest, Basic) { // Fake extension diff --git a/sycl/unittests/program_manager/DynamicLinking.cpp b/sycl/unittests/program_manager/DynamicLinking.cpp index 0acdd4344f163..8c291e7f22a49 100644 --- a/sycl/unittests/program_manager/DynamicLinking.cpp +++ b/sycl/unittests/program_manager/DynamicLinking.cpp @@ -55,7 +55,7 @@ createPropertySet(const std::vector &Symbols) { return Props; } -sycl::unittest::UrImage +sycl::unittest::MockDeviceImage generateImage(std::initializer_list KernelNames, const std::vector &ExportedSymbols, const std::vector &ImportedSymbols, @@ -74,7 +74,7 @@ generateImage(std::initializer_list KernelNames, sycl::unittest::UrArray Entries = sycl::unittest::makeEmptyKernels(KernelNames); - sycl::unittest::UrImage Img{ + sycl::unittest::MockDeviceImage Img{ BinType, __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec "", // Compile options @@ -96,7 +96,7 @@ static constexpr unsigned MUTUAL_DEP_PRG_B = 17; static constexpr unsigned AOT_CASE_PRG_NATIVE = 23; static constexpr unsigned AOT_CASE_PRG_DEP_NATIVE = 29; -static sycl::unittest::UrImage Imgs[] = { +static sycl::unittest::MockDeviceImage Imgs[] = { generateImage({"BasicCaseKernel"}, {}, {"BasicCaseKernelDep"}, BASIC_CASE_PRG), generateImage({"BasicCaseKernelDep"}, {"BasicCaseKernelDep"}, @@ -120,7 +120,7 @@ static sycl::unittest::UrImage Imgs[] = { AOT_CASE_PRG_DEP_NATIVE, SYCL_DEVICE_BINARY_TYPE_NATIVE)}; // Registers mock devices images in the SYCL RT -static sycl::unittest::UrImageArray<9> ImgArray{Imgs}; +static sycl::unittest::MockDeviceImageArray<9> ImgArray{Imgs}; TEST(DynamicLinking, BasicCase) { sycl::unittest::UrMock<> Mock; diff --git a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp index 1069dd7131efd..1e9351ac1501e 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -43,7 +43,7 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateEAMTestKernelImage() { +static sycl::unittest::MockDeviceImage generateEAMTestKernelImage() { using namespace sycl::unittest; // Eliminated arguments are 1st and 3rd. @@ -59,18 +59,18 @@ static sycl::unittest::UrImage generateEAMTestKernelImage() { UrArray Entries = makeEmptyKernels({EAMTestKernelName}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage generateEAMTestKernel2Image() { +static sycl::unittest::MockDeviceImage generateEAMTestKernel2Image() { using namespace sycl::unittest; UrPropertySet PropSet; @@ -79,21 +79,21 @@ static sycl::unittest::UrImage generateEAMTestKernel2Image() { UrArray Entries = makeEmptyKernels({EAMTestKernel2Name}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::UrImage EAMImg = generateEAMTestKernelImage(); -static sycl::unittest::UrImage EAM2Img = generateEAMTestKernel2Image(); -static sycl::unittest::UrImageArray<1> EAMImgArray{&EAMImg}; -static sycl::unittest::UrImageArray<1> EAM2ImgArray{&EAM2Img}; +static sycl::unittest::MockDeviceImage EAMImg = generateEAMTestKernelImage(); +static sycl::unittest::MockDeviceImage EAM2Img = generateEAMTestKernel2Image(); +static sycl::unittest::MockDeviceImageArray<1> EAMImgArray{&EAMImg}; +static sycl::unittest::MockDeviceImageArray<1> EAM2ImgArray{&EAM2Img}; // ur_program_handle_t address is used as a key for ProgramManager::NativePrograms // storage. redefinedProgramLinkCommon makes ur_program_handle_t address equal to 0x1. diff --git a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp index 4d5ec4e26f851..9b790672291ae 100644 --- a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp +++ b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp @@ -56,7 +56,7 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace sycl template -static sycl::unittest::UrImage +static sycl::unittest::MockDeviceImage generateEAMTestKernelImage(std::string _cmplOptions, std::string _lnkOptions) { using namespace sycl::unittest; @@ -74,13 +74,13 @@ generateEAMTestKernelImage(std::string _cmplOptions, std::string _lnkOptions) { UrArray Entries = makeEmptyKernels({sycl::detail::KernelInfo::getName()}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - _cmplOptions, // Compile options - _lnkOptions, // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + _cmplOptions, // Compile options + _lnkOptions, // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } @@ -126,10 +126,10 @@ TEST(Link_Compile_Options, compile_link_Options_Test_empty_options) { current_link_options.clear(); current_compile_options.clear(); std::string expected_options = ""; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = generateEAMTestKernelImage(expected_options, expected_options); - static sycl::unittest::UrImageArray<1> DevImageArray_{&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray_{&DevImage}; auto KernelID_1 = sycl::get_kernel_id(); sycl::queue Queue{Dev}; const sycl::context Ctx = Queue.get_context(); @@ -156,11 +156,11 @@ TEST(Link_Compile_Options, compile_link_Options_Test_filled_options) { "-cl-opt-disable -cl-fp32-correctly-rounded-divide-sqrt", expected_link_options_1 = "-cl-denorms-are-zero -cl-no-signed-zeros"; - static sycl::unittest::UrImage DevImage_1 = + static sycl::unittest::MockDeviceImage DevImage_1 = generateEAMTestKernelImage(expected_compile_options_1, expected_link_options_1); - static sycl::unittest::UrImageArray<1> DevImageArray = {&DevImage_1}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray = {&DevImage_1}; auto KernelID_1 = sycl::get_kernel_id(); sycl::queue Queue{Dev}; const sycl::context Ctx = Queue.get_context(); @@ -191,10 +191,10 @@ TEST(Link_Compile_Options, check_sycl_build) { current_compile_options.clear(); std::string expected_compile_options = "-cl-opt-disable", expected_link_options = "-cl-denorms-are-zero"; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = generateEAMTestKernelImage(expected_compile_options, expected_link_options); - static sycl::unittest::UrImageArray<1> DevImageArray{&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray{&DevImage}; auto KernelID = sycl::get_kernel_id(); sycl::context Ctx{Dev}; sycl::queue Queue{Ctx, Dev}; diff --git a/sycl/unittests/queue/GetProfilingInfo.cpp b/sycl/unittests/queue/GetProfilingInfo.cpp index a37b399f725ce..1889c6d742eaa 100644 --- a/sycl/unittests/queue/GetProfilingInfo.cpp +++ b/sycl/unittests/queue/GetProfilingInfo.cpp @@ -51,10 +51,10 @@ TEST(GetProfilingInfo, normal_pass_without_exception) { &redefinedUrEventGetProfilingInfo); const sycl::device Dev = Plt.get_devices()[0]; sycl::context Ctx{Dev}; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = sycl::unittest::generateDefaultImage({"InfoTestKernel"}); - static sycl::unittest::UrImageArray<1> DevImageArray = {&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray = {&DevImage}; auto KernelID = sycl::get_kernel_id(); sycl::queue Queue{ Ctx, Dev, sycl::property_list{sycl::property::queue::enable_profiling{}}}; @@ -89,9 +89,9 @@ TEST(GetProfilingInfo, command_exception_check) { &redefinedUrEventGetProfilingInfo); const sycl::device Dev = Plt.get_devices()[0]; sycl::context Ctx{Dev}; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = sycl::unittest::generateDefaultImage({"InfoTestKernel"}); - static sycl::unittest::UrImageArray<1> DevImageArray = {&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray = {&DevImage}; auto KernelID = sycl::get_kernel_id(); sycl::queue Queue{Ctx, Dev}; auto KernelBundle = sycl::get_kernel_bundle( @@ -190,9 +190,9 @@ TEST(GetProfilingInfo, check_if_now_dead_queue_property_set) { &redefinedUrEventGetProfilingInfo); const sycl::device Dev = Plt.get_devices()[0]; sycl::context Ctx{Dev}; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = sycl::unittest::generateDefaultImage({"InfoTestKernel"}); - static sycl::unittest::UrImageArray<1> DevImageArray = {&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray = {&DevImage}; auto KernelID = sycl::get_kernel_id(); const int globalWIs{512}; sycl::event event; @@ -230,10 +230,10 @@ TEST(GetProfilingInfo, check_if_now_dead_queue_property_not_set) { &redefinedUrEventGetProfilingInfo); const sycl::device Dev = Plt.get_devices()[0]; sycl::context Ctx{Dev}; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = sycl::unittest::generateDefaultImage({"InfoTestKernel"}); - static sycl::unittest::UrImageArray<1> DevImageArray = {&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray = {&DevImage}; auto KernelID = sycl::get_kernel_id(); const int globalWIs{512}; sycl::event event; @@ -372,9 +372,9 @@ TEST(GetProfilingInfo, fallback_profiling_PiGetDeviceAndHostTimer_unsupported) { &redefinedDeviceGetInfoAcc); const sycl::device Dev = Plt.get_devices()[0]; sycl::context Ctx{Dev}; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = sycl::unittest::generateDefaultImage({"InfoTestKernel"}); - static sycl::unittest::UrImageArray<1> DevImageArray = {&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray = {&DevImage}; auto KernelID = sycl::get_kernel_id(); sycl::queue Queue{ Ctx, Dev, sycl::property_list{sycl::property::queue::enable_profiling{}}}; @@ -412,9 +412,9 @@ TEST(GetProfilingInfo, fallback_profiling_mock_piEnqueueKernelLaunch) { &redefinedDeviceGetInfoAcc); const sycl::device Dev = Plt.get_devices()[0]; sycl::context Ctx{Dev}; - static sycl::unittest::UrImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = sycl::unittest::generateDefaultImage({"InfoTestKernel"}); - static sycl::unittest::UrImageArray<1> DevImageArray = {&DevImage}; + static sycl::unittest::MockDeviceImageArray<1> DevImageArray = {&DevImage}; auto KernelID = sycl::get_kernel_id(); sycl::queue Queue{ Ctx, Dev, sycl::property_list{sycl::property::queue::enable_profiling{}}}; diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index 8ea3f6a9c4f48..f51f383366cdc 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -102,7 +102,7 @@ struct KernelInfo } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; UrPropertySet PropSet; @@ -112,19 +112,19 @@ static sycl::unittest::UrImage generateDefaultImage() { UrArray Entries = makeEmptyKernels({"StreamAUXCmdsWait_TestKernel"}); - UrImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -sycl::unittest::UrImage Img = generateDefaultImage(); -sycl::unittest::UrImageArray<1> ImgArray{&Img}; +sycl::unittest::MockDeviceImage Img = generateDefaultImage(); +sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img}; class EventImplProxyT : public sycl::detail::event_impl { public: From 75a80dda09fb0307d950984cc20dd80e2a5be7bc Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Sun, 28 Jul 2024 02:23:04 -0700 Subject: [PATCH 3/9] Rename UrArray -> Array --- sycl/unittests/Extensions/DeviceGlobal.cpp | 8 ++-- sycl/unittests/Extensions/USMMemcpy2D.cpp | 2 +- .../VirtualFunctions/RuntimeLinking.cpp | 4 +- sycl/unittests/SYCL2020/IsCompatible.cpp | 2 +- sycl/unittests/SYCL2020/KernelBundle.cpp | 2 +- .../SYCL2020/KernelBundleStateFiltering.cpp | 2 +- sycl/unittests/SYCL2020/KernelID.cpp | 2 +- .../SYCL2020/SpecializationConstant.cpp | 2 +- sycl/unittests/assert/assert.cpp | 4 +- sycl/unittests/helpers/MockDeviceImage.hpp | 40 +++++++++---------- sycl/unittests/kernel-and-program/Cache.cpp | 2 +- .../kernel-and-program/KernelBuildOptions.cpp | 2 +- .../pipes/host_pipe_registration.cpp | 4 +- .../program_manager/DynamicLinking.cpp | 6 +-- .../arg_mask/EliminatedArgMask.cpp | 6 +-- .../passing_link_and_compile_options.cpp | 4 +- .../scheduler/CommandsWaitForEvents.cpp | 2 +- 17 files changed, 47 insertions(+), 47 deletions(-) diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index 5f800fe03a355..b7c284acc4934 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -65,11 +65,11 @@ static sycl::unittest::MockDeviceImage generateDeviceGlobalImage() { UrProperty DevGlobInfo = makeDeviceGlobalInfo(DeviceGlobalName, sizeof(int) * 2, 0); PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS, - UrArray{std::move(DevGlobInfo)}); + Array{std::move(DevGlobInfo)}); std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - UrArray Entries = + Array Entries = makeEmptyKernels({DeviceGlobalTestKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format @@ -96,11 +96,11 @@ static sycl::unittest::MockDeviceImage generateDeviceGlobalImgScopeImage() { UrProperty DevGlobInfo = makeDeviceGlobalInfo(DeviceGlobalImgScopeName, sizeof(int) * 2, 1); PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS, - UrArray{std::move(DevGlobInfo)}); + Array{std::move(DevGlobInfo)}); std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - UrArray Entries = + Array Entries = makeEmptyKernels({DeviceGlobalImgScopeTestKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index 35791e50975da..d852cee02eb9f 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -132,7 +132,7 @@ static sycl::unittest::MockDeviceImage generateMemopsImage() { std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - UrArray Entries = makeEmptyKernels( + Array Entries = makeEmptyKernels( {USMFillHelperKernelNameLong, USMFillHelperKernelNameChar, USMMemcpyHelperKernelNameLong, USMMemcpyHelperKernelNameChar}); diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index eb17af64027f9..5b5504c985b9f 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -50,7 +50,7 @@ static sycl::unittest::MockDeviceImage generateImage(std::initializer_list KernelNames, const std::string &VFSets, bool UsesVFSets, unsigned char Magic) { sycl::unittest::UrPropertySet PropSet; - sycl::unittest::UrArray Props; + sycl::unittest::Array Props; uint64_t PropSize = VFSets.size(); std::vector Storage(/* bytes for size */ 8 + PropSize + /* null terminator */ 1); @@ -69,7 +69,7 @@ generateImage(std::initializer_list KernelNames, std::vector Bin{Magic}; - sycl::unittest::UrArray Entries = + sycl::unittest::Array Entries = sycl::unittest::makeEmptyKernels(KernelNames); sycl::unittest::MockDeviceImage Img{ diff --git a/sycl/unittests/SYCL2020/IsCompatible.cpp b/sycl/unittests/SYCL2020/IsCompatible.cpp index a8f82f58a8a5f..bcd29289f1c58 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -33,7 +33,7 @@ generateDefaultImage(std::initializer_list KernelNames, std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index 28aa39a6713bf..e414d10f55ce2 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -37,7 +37,7 @@ generateDefaultImage(std::initializer_list KernelNames, std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{BinaryType, // Format DeviceTargetSpec, diff --git a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp index cec11eb4fdffc..0a3a28e0b864d 100644 --- a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp +++ b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp @@ -46,7 +46,7 @@ generateDefaultImage(std::initializer_list KernelNames, static unsigned char NImage = 0; std::vector Bin{NImage++}; - UrArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{BinaryType, // Format DeviceTargetSpec, diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index 6986900f842bc..d32d0f09d55fa 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -55,7 +55,7 @@ generateDefaultImage(std::initializer_list Kernels) { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels(Kernels); + Array Entries = makeEmptyKernels(Kernels); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 1b422dabb2345..84acb0616a6c1 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -49,7 +49,7 @@ static sycl::unittest::MockDeviceImage generateImageWithSpecConsts() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = + Array Entries = makeEmptyKernels({"SpecializationConstant_TestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 770d2b4d07f00..18ab590dc225e 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -86,7 +86,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels({KernelName}); + Array Entries = makeEmptyKernels({KernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec @@ -109,7 +109,7 @@ static sycl::unittest::MockDeviceImage generateCopierKernelImage() { std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - UrArray Entries = makeEmptyKernels({CopierKernelName}); + Array Entries = makeEmptyKernels({CopierKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index aa0dfabe6931f..4962799da8340 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -111,17 +111,17 @@ class UrOffloadEntry { }; /// Generic array of UR entries. -template class UrArray { +template class Array { public: - explicit UrArray(std::vector Entries) : MMockEntries(std::move(Entries)) { + explicit Array(std::vector Entries) : MMockEntries(std::move(Entries)) { updateEntries(); } - UrArray(std::initializer_list Entries) : MMockEntries(std::move(Entries)) { + Array(std::initializer_list Entries) : MMockEntries(std::move(Entries)) { updateEntries(); } - UrArray() = default; + Array() = default; void push_back(const T &Entry) { MMockEntries.push_back(Entry); @@ -162,9 +162,9 @@ template class UrArray { }; #ifdef __cpp_deduction_guides -template UrArray(std::vector) -> UrArray; +template Array(std::vector) -> Array; -template UrArray(std::initializer_list) -> UrArray; +template Array(std::initializer_list) -> Array; #endif // __cpp_deduction_guides /// Convenience wrapper for sycl_device_binary_property_set. @@ -188,14 +188,14 @@ class UrPropertySet { // Value must be an all-zero 32-bit mask, which would mean that no fallback // libraries are needed to be loaded. UrProperty DeviceLibReqMask("", Data, SYCL_PROPERTY_TYPE_UINT32); - insert(__SYCL_PROPERTY_SET_DEVICELIB_REQ_MASK, UrArray{DeviceLibReqMask}); + insert(__SYCL_PROPERTY_SET_DEVICELIB_REQ_MASK, Array{DeviceLibReqMask}); } /// Adds a new array of properties to the set. /// /// \param Name is a property array name. See ur.hpp for list of known names. /// \param Props is an array of property values. - void insert(const std::string &Name, UrArray Props) { + void insert(const std::string &Name, Array Props) { MNames.push_back(Name); MMockProperties.push_back(std::move(Props)); MProperties.push_back(_sycl_device_binary_property_set_struct{ @@ -217,7 +217,7 @@ class UrPropertySet { private: std::vector MNames; - std::vector> MMockProperties; + std::vector> MMockProperties; std::vector<_sycl_device_binary_property_set_struct> MProperties; }; @@ -231,7 +231,7 @@ class MockDeviceImage { const std::string &CompileOptions, const std::string &LinkOptions, std::vector Manifest, std::vector Binary, - UrArray OffloadEntries, + Array OffloadEntries, UrPropertySet PropertySet) : MVersion(Version), MKind(Kind), MFormat(Format), MDeviceTargetSpec(DeviceTargetSpec), MCompileOptions(CompileOptions), @@ -244,7 +244,7 @@ class MockDeviceImage { const std::string &CompileOptions, const std::string &LinkOptions, std::vector Binary, - UrArray OffloadEntries, + Array OffloadEntries, UrPropertySet PropertySet) : MockDeviceImage(SYCL_DEVICE_BINARY_VERSION, SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, Format, @@ -281,7 +281,7 @@ class MockDeviceImage { std::string MLinkOptions; std::vector MManifest; std::vector MBinary; - UrArray MOffloadEntries; + Array MOffloadEntries; UrPropertySet MPropertySet; }; @@ -398,7 +398,7 @@ inline UrProperty makeSpecConstant(std::vector &ValData, /// Utility function to mark kernel as the one using assert inline void setKernelUsesAssert(const std::vector &Names, UrPropertySet &Set) { - UrArray Value; + Array Value; for (const std::string &N : Names) Value.push_back({N, {0, 0, 0, 0}, SYCL_PROPERTY_TYPE_UINT32}); Set.insert(__SYCL_PROPERTY_SET_SYCL_ASSERT_USED, std::move(Value)); @@ -407,13 +407,13 @@ inline void setKernelUsesAssert(const std::vector &Names, /// Utility function to add specialization constants to property set. /// /// This function overrides the default spec constant values. -inline void addSpecConstants(UrArray SpecConstants, +inline void addSpecConstants(Array SpecConstants, std::vector ValData, UrPropertySet &Props) { Props.insert(__SYCL_PROPERTY_SET_SPEC_CONST_MAP, std::move(SpecConstants)); UrProperty Prop{"all", std::move(ValData), SYCL_PROPERTY_TYPE_BYTE_ARRAY}; - UrArray DefaultValues{std::move(Prop)}; + Array DefaultValues{std::move(Prop)}; Props.insert(__SYCL_PROPERTY_SET_SPEC_CONST_DEFAULT_VALUES_MAP, std::move(DefaultValues)); @@ -425,15 +425,15 @@ inline void addESIMDFlag(UrPropertySet &Props) { ValData[0] = 1; UrProperty Prop{"isEsimdImage", ValData, SYCL_PROPERTY_TYPE_UINT32}; - UrArray Value{std::move(Prop)}; + Array Value{std::move(Prop)}; Props.insert(__SYCL_PROPERTY_SET_SYCL_MISC_PROP, std::move(Value)); } /// Utility function to generate offload entries for kernels without arguments. -inline UrArray +inline Array makeEmptyKernels(std::initializer_list KernelNames) { - UrArray Entries; + Array Entries; for (const auto &Name : KernelNames) { UrOffloadEntry E{Name, {}, 0}; @@ -537,7 +537,7 @@ inline void addDeviceRequirementsProps(UrPropertySet &Props, const std::vector &Aspects, const std::vector &ReqdWGSize = {}) { - UrArray Value{makeAspectsProp(Aspects)}; + Array Value{makeAspectsProp(Aspects)}; if (!ReqdWGSize.empty()) Value.push_back(makeReqdWGSizeProp(ReqdWGSize)); Props.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS, std::move(Value)); @@ -549,7 +549,7 @@ generateDefaultImage(std::initializer_list KernelNames) { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index c6bdd18a8cf1c..ee8023875bac9 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -61,7 +61,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = + Array Entries = makeEmptyKernels({"CacheTestKernel", "CacheTestKernel2"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format diff --git a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp index 66d5bf850cf77..115c1586a6488 100644 --- a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp +++ b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp @@ -78,7 +78,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels({"BuildOptsTestKernel"}); + Array Entries = makeEmptyKernels({"BuildOptsTestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index e70535c6b5d9e..83573c24c2aea 100644 --- a/sycl/unittests/pipes/host_pipe_registration.cpp +++ b/sycl/unittests/pipes/host_pipe_registration.cpp @@ -39,11 +39,11 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { UrProperty HostPipeInfo = makeHostPipeInfo("test_host_pipe_unique_id", sizeof(int)); PropSet.insert(__SYCL_PROPERTY_SET_SYCL_HOST_PIPES, - UrArray{std::move(HostPipeInfo)}); + Array{std::move(HostPipeInfo)}); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels({"TestKernel"}); + Array Entries = makeEmptyKernels({"TestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/program_manager/DynamicLinking.cpp b/sycl/unittests/program_manager/DynamicLinking.cpp index 8c291e7f22a49..f2406f8784a8b 100644 --- a/sycl/unittests/program_manager/DynamicLinking.cpp +++ b/sycl/unittests/program_manager/DynamicLinking.cpp @@ -37,10 +37,10 @@ KERNEL_INFO(AOTCaseKernel) } // namespace sycl namespace { -sycl::unittest::UrArray +sycl::unittest::Array createPropertySet(const std::vector &Symbols) { sycl::unittest::UrPropertySet PropSet; - sycl::unittest::UrArray Props; + sycl::unittest::Array Props; for (const std::string &Symbol : Symbols) { std::vector Storage(sizeof(uint32_t)); uint32_t Val = 1; @@ -71,7 +71,7 @@ generateImage(std::initializer_list KernelNames, createPropertySet(ImportedSymbols)); std::vector Bin{Magic}; - sycl::unittest::UrArray Entries = + sycl::unittest::Array Entries = sycl::unittest::makeEmptyKernels(KernelNames); sycl::unittest::MockDeviceImage Img{ diff --git a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp index 1e9351ac1501e..312d0c4ddfd2d 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -50,14 +50,14 @@ static sycl::unittest::MockDeviceImage generateEAMTestKernelImage() { std::vector KernelEAM{0b00000101}; UrProperty EAMKernelPOI = makeKernelParamOptInfo( EAMTestKernelName, EAMTestKernelNumArgs, KernelEAM); - UrArray ImgKPOI{std::move(EAMKernelPOI)}; + Array ImgKPOI{std::move(EAMKernelPOI)}; UrPropertySet PropSet; PropSet.insert(__SYCL_PROPERTY_SET_KERNEL_PARAM_OPT_INFO, std::move(ImgKPOI)); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = makeEmptyKernels({EAMTestKernelName}); + Array Entries = makeEmptyKernels({EAMTestKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec @@ -77,7 +77,7 @@ static sycl::unittest::MockDeviceImage generateEAMTestKernel2Image() { std::vector Bin{6, 7, 8, 9, 10, 11}; // Random data - UrArray Entries = makeEmptyKernels({EAMTestKernel2Name}); + Array Entries = makeEmptyKernels({EAMTestKernel2Name}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp index 9b790672291ae..0944acca31559 100644 --- a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp +++ b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp @@ -64,14 +64,14 @@ generateEAMTestKernelImage(std::string _cmplOptions, std::string _lnkOptions) { UrProperty EAMKernelPOI = makeKernelParamOptInfo(sycl::detail::KernelInfo::getName(), EAMTestKernelNumArgs1, KernelEAM1); - UrArray ImgKPOI{std::move(EAMKernelPOI)}; + Array ImgKPOI{std::move(EAMKernelPOI)}; UrPropertySet PropSet; PropSet.insert(__SYCL_PROPERTY_SET_KERNEL_PARAM_OPT_INFO, std::move(ImgKPOI)); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = + Array Entries = makeEmptyKernels({sycl::detail::KernelInfo::getName()}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index f51f383366cdc..9c2415504efeb 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -109,7 +109,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - UrArray Entries = + Array Entries = makeEmptyKernels({"StreamAUXCmdsWait_TestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format From 099cecc6bc3fe10715e962f8dbcd0185f3a04c99 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Sun, 28 Jul 2024 02:24:09 -0700 Subject: [PATCH 4/9] Rename UrProperty[Set] -> MockProperty[Set] --- sycl/unittests/Extensions/DeviceGlobal.cpp | 12 +-- sycl/unittests/Extensions/USMMemcpy2D.cpp | 2 +- .../VirtualFunctions/RuntimeLinking.cpp | 8 +- sycl/unittests/SYCL2020/IsCompatible.cpp | 2 +- sycl/unittests/SYCL2020/KernelBundle.cpp | 2 +- .../SYCL2020/KernelBundleStateFiltering.cpp | 2 +- sycl/unittests/SYCL2020/KernelID.cpp | 2 +- .../SYCL2020/SpecializationConstant.cpp | 7 +- sycl/unittests/assert/assert.cpp | 4 +- sycl/unittests/helpers/MockDeviceImage.hpp | 83 ++++++++++--------- sycl/unittests/kernel-and-program/Cache.cpp | 5 +- .../kernel-and-program/KernelBuildOptions.cpp | 2 +- .../pipes/host_pipe_registration.cpp | 6 +- .../program_manager/DynamicLinking.cpp | 11 +-- .../arg_mask/EliminatedArgMask.cpp | 8 +- .../passing_link_and_compile_options.cpp | 6 +- .../scheduler/CommandsWaitForEvents.cpp | 2 +- 17 files changed, 84 insertions(+), 80 deletions(-) diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index b7c284acc4934..43fb56b39424c 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -61,11 +61,11 @@ static sycl::unittest::MockDeviceImage generateDeviceGlobalImage() { sycl::detail::device_global_map::add(&DeviceGlobal, DeviceGlobalName); // Insert remaining device global info into the binary. - UrPropertySet PropSet; - UrProperty DevGlobInfo = + MockPropertySet PropSet; + MockProperty DevGlobInfo = makeDeviceGlobalInfo(DeviceGlobalName, sizeof(int) * 2, 0); PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS, - Array{std::move(DevGlobInfo)}); + Array{std::move(DevGlobInfo)}); std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data @@ -92,11 +92,11 @@ static sycl::unittest::MockDeviceImage generateDeviceGlobalImgScopeImage() { DeviceGlobalImgScopeName); // Insert remaining device global info into the binary. - UrPropertySet PropSet; - UrProperty DevGlobInfo = + MockPropertySet PropSet; + MockProperty DevGlobInfo = makeDeviceGlobalInfo(DeviceGlobalImgScopeName, sizeof(int) * 2, 1); PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS, - Array{std::move(DevGlobInfo)}); + Array{std::move(DevGlobInfo)}); std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index d852cee02eb9f..2860ac7603de7 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -128,7 +128,7 @@ struct KernelInfo> static sycl::unittest::MockDeviceImage generateMemopsImage() { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index 5b5504c985b9f..3565a1440ab8a 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -49,8 +49,8 @@ KERNEL_INFO(KernelG) static sycl::unittest::MockDeviceImage generateImage(std::initializer_list KernelNames, const std::string &VFSets, bool UsesVFSets, unsigned char Magic) { - sycl::unittest::UrPropertySet PropSet; - sycl::unittest::Array Props; + sycl::unittest::MockPropertySet PropSet; + sycl::unittest::Array Props; uint64_t PropSize = VFSets.size(); std::vector Storage(/* bytes for size */ 8 + PropSize + /* null terminator */ 1); @@ -61,8 +61,8 @@ generateImage(std::initializer_list KernelNames, Storage.back() = '\0'; const std::string PropName = UsesVFSets ? "uses-virtual-functions-set" : "virtual-functions-set"; - sycl::unittest::UrProperty Prop(PropName, Storage, - SYCL_PROPERTY_TYPE_BYTE_ARRAY); + sycl::unittest::MockProperty Prop(PropName, Storage, + SYCL_PROPERTY_TYPE_BYTE_ARRAY); Props.push_back(Prop); PropSet.insert(__SYCL_PROPERTY_SET_SYCL_VIRTUAL_FUNCTIONS, std::move(Props)); diff --git a/sycl/unittests/SYCL2020/IsCompatible.cpp b/sycl/unittests/SYCL2020/IsCompatible.cpp index bcd29289f1c58..88836fb4378de 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -28,7 +28,7 @@ generateDefaultImage(std::initializer_list KernelNames, const std::vector &ReqdWGSize = {}) { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; addDeviceRequirementsProps(PropSet, Aspects, ReqdWGSize); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index e414d10f55ce2..763536eb123ed 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -31,7 +31,7 @@ generateDefaultImage(std::initializer_list KernelNames, const std::vector &Aspects = {}) { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; if (!Aspects.empty()) addDeviceRequirementsProps(PropSet, Aspects); diff --git a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp index 0a3a28e0b864d..c92e3062bd7d3 100644 --- a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp +++ b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp @@ -41,7 +41,7 @@ generateDefaultImage(std::initializer_list KernelNames, const char *DeviceTargetSpec) { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; static unsigned char NImage = 0; std::vector Bin{NImage++}; diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index d32d0f09d55fa..633cc03f96748 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -51,7 +51,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list Kernels) { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 84acb0616a6c1..c7d7cb593073c 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -41,10 +41,11 @@ static sycl::unittest::MockDeviceImage generateImageWithSpecConsts() { using namespace sycl::unittest; std::vector SpecConstData; - UrProperty SC1 = makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); - UrProperty SC2 = makeSpecConstant(SpecConstData, "SC2", {1}, {0}, {8}); + MockProperty SC1 = + makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); + MockProperty SC2 = makeSpecConstant(SpecConstData, "SC2", {1}, {0}, {8}); - UrPropertySet PropSet; + MockPropertySet PropSet; addSpecConstants({SC1, SC2}, std::move(SpecConstData), PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 18ab590dc225e..540930a8a1c21 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -80,7 +80,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { static const std::string CopierKernelName = "_ZTSN2cl4sycl6detail23__sycl_service_kernel__16AssertInfoCopierE"; - UrPropertySet PropSet; + MockPropertySet PropSet; setKernelUsesAssert({KernelName}, PropSet); @@ -105,7 +105,7 @@ static sycl::unittest::MockDeviceImage generateCopierKernelImage() { static const std::string CopierKernelName = "_ZTSN2cl4sycl6detail23__sycl_service_kernel__16AssertInfoCopierE"; - UrPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index 4962799da8340..6575d94eaa76a 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -23,7 +23,7 @@ namespace unittest { using namespace sycl::detail; /// Convinience wrapper around _ur_device_binary_property_struct. -class UrProperty { +class MockProperty { public: using NativeType = _sycl_device_binary_property_struct; @@ -32,21 +32,21 @@ class UrProperty { /// \param Name is a property name. /// \param Data is a vector of raw property value bytes. /// \param Type is one of ur_property_type values. - UrProperty(const std::string &Name, std::vector Data, uint32_t Type) + MockProperty(const std::string &Name, std::vector Data, uint32_t Type) : MName(Name), MData(std::move(Data)), MType(Type) { updateNativeType(); } NativeType convertToNativeType() const { return MNative; } - UrProperty(const UrProperty &Src) { + MockProperty(const MockProperty &Src) { MName = Src.MName; MData = Src.MData; MType = Src.MType; updateNativeType(); } - UrProperty &operator=(const UrProperty &Src) { + MockProperty &operator=(const MockProperty &Src) { MName = Src.MName; MData = Src.MData; MType = Src.MType; @@ -168,9 +168,9 @@ template Array(std::initializer_list) -> Array; #endif // __cpp_deduction_guides /// Convenience wrapper for sycl_device_binary_property_set. -class UrPropertySet { +class MockPropertySet { public: - UrPropertySet() { + MockPropertySet() { // Most of unit-tests are statically linked with SYCL RT. On Linux and Mac // systems that causes incorrect RT installation directory detection, which // prevents proper loading of fallback libraries. See intel/llvm#6945 @@ -187,7 +187,7 @@ class UrPropertySet { // Name doesn't matter here, it is not used by RT // Value must be an all-zero 32-bit mask, which would mean that no fallback // libraries are needed to be loaded. - UrProperty DeviceLibReqMask("", Data, SYCL_PROPERTY_TYPE_UINT32); + MockProperty DeviceLibReqMask("", Data, SYCL_PROPERTY_TYPE_UINT32); insert(__SYCL_PROPERTY_SET_DEVICELIB_REQ_MASK, Array{DeviceLibReqMask}); } @@ -195,7 +195,7 @@ class UrPropertySet { /// /// \param Name is a property array name. See ur.hpp for list of known names. /// \param Props is an array of property values. - void insert(const std::string &Name, Array Props) { + void insert(const std::string &Name, Array Props) { MNames.push_back(Name); MMockProperties.push_back(std::move(Props)); MProperties.push_back(_sycl_device_binary_property_set_struct{ @@ -217,7 +217,7 @@ class UrPropertySet { private: std::vector MNames; - std::vector> MMockProperties; + std::vector> MMockProperties; std::vector<_sycl_device_binary_property_set_struct> MProperties; }; @@ -232,7 +232,7 @@ class MockDeviceImage { const std::string &LinkOptions, std::vector Manifest, std::vector Binary, Array OffloadEntries, - UrPropertySet PropertySet) + MockPropertySet PropertySet) : MVersion(Version), MKind(Kind), MFormat(Format), MDeviceTargetSpec(DeviceTargetSpec), MCompileOptions(CompileOptions), MLinkOptions(LinkOptions), MManifest(std::move(Manifest)), @@ -245,7 +245,7 @@ class MockDeviceImage { const std::string &LinkOptions, std::vector Binary, Array OffloadEntries, - UrPropertySet PropertySet) + MockPropertySet PropertySet) : MockDeviceImage(SYCL_DEVICE_BINARY_VERSION, SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, Format, DeviceTargetSpec, CompileOptions, LinkOptions, {}, @@ -282,7 +282,7 @@ class MockDeviceImage { std::vector MManifest; std::vector MBinary; Array MOffloadEntries; - UrPropertySet MPropertySet; + MockPropertySet MPropertySet; }; /// Convenience wrapper around sycl_device_binaries_struct, that manages mock @@ -338,11 +338,11 @@ template /// \param Offsets is a list of offsets inside composite spec constant. /// \param DefaultValues is a tuple of default values for composite spec const. template -inline UrProperty makeSpecConstant(std::vector &ValData, - const std::string &Name, - std::initializer_list IDs, - std::initializer_list Offsets, - std::tuple DefaultValues) { +inline MockProperty makeSpecConstant(std::vector &ValData, + const std::string &Name, + std::initializer_list IDs, + std::initializer_list Offsets, + std::tuple DefaultValues) { const size_t PropByteArraySize = sizeof...(T) * sizeof(uint32_t) * 3; std::vector DescData; DescData.resize(8 + PropByteArraySize); @@ -390,15 +390,15 @@ inline UrProperty makeSpecConstant(std::vector &ValData, iterate_tuple(FillData, DefaultValues); - UrProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } /// Utility function to mark kernel as the one using assert inline void setKernelUsesAssert(const std::vector &Names, - UrPropertySet &Set) { - Array Value; + MockPropertySet &Set) { + Array Value; for (const std::string &N : Names) Value.push_back({N, {0, 0, 0, 0}, SYCL_PROPERTY_TYPE_UINT32}); Set.insert(__SYCL_PROPERTY_SET_SYCL_ASSERT_USED, std::move(Value)); @@ -407,25 +407,26 @@ inline void setKernelUsesAssert(const std::vector &Names, /// Utility function to add specialization constants to property set. /// /// This function overrides the default spec constant values. -inline void addSpecConstants(Array SpecConstants, - std::vector ValData, UrPropertySet &Props) { +inline void addSpecConstants(Array SpecConstants, + std::vector ValData, + MockPropertySet &Props) { Props.insert(__SYCL_PROPERTY_SET_SPEC_CONST_MAP, std::move(SpecConstants)); - UrProperty Prop{"all", std::move(ValData), SYCL_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{"all", std::move(ValData), SYCL_PROPERTY_TYPE_BYTE_ARRAY}; - Array DefaultValues{std::move(Prop)}; + Array DefaultValues{std::move(Prop)}; Props.insert(__SYCL_PROPERTY_SET_SPEC_CONST_DEFAULT_VALUES_MAP, std::move(DefaultValues)); } /// Utility function to add ESIMD kernel flag to property set. -inline void addESIMDFlag(UrPropertySet &Props) { +inline void addESIMDFlag(MockPropertySet &Props) { std::vector ValData(sizeof(uint32_t)); ValData[0] = 1; - UrProperty Prop{"isEsimdImage", ValData, SYCL_PROPERTY_TYPE_UINT32}; + MockProperty Prop{"isEsimdImage", ValData, SYCL_PROPERTY_TYPE_UINT32}; - Array Value{std::move(Prop)}; + Array Value{std::move(Prop)}; Props.insert(__SYCL_PROPERTY_SET_SYCL_MISC_PROP, std::move(Value)); } @@ -447,7 +448,7 @@ makeEmptyKernels(std::initializer_list KernelNames) { /// \param Name is a property name. /// \param NumArgs is a total number of arguments of a kernel. /// \param ElimArgMask is a bit mask of eliminated kernel arguments IDs. -inline UrProperty +inline MockProperty makeKernelParamOptInfo(const std::string &Name, const size_t NumArgs, const std::vector &ElimArgMask) { const size_t BYTES_FOR_SIZE = 8; @@ -459,7 +460,7 @@ makeKernelParamOptInfo(const std::string &Name, const size_t NumArgs, std::uninitialized_copy(ElimArgMask.begin(), ElimArgMask.end(), DescData.data() + BYTES_FOR_SIZE); - UrProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } @@ -470,9 +471,9 @@ makeKernelParamOptInfo(const std::string &Name, const size_t NumArgs, /// \param TypeSize is the size of the underlying type in the device global. /// \param DeviceImageScoped is whether the device global was device image scope /// decorated. -inline UrProperty makeDeviceGlobalInfo(const std::string &Name, - const uint32_t TypeSize, - const std::uint32_t DeviceImageScoped) { +inline MockProperty +makeDeviceGlobalInfo(const std::string &Name, const uint32_t TypeSize, + const std::uint32_t DeviceImageScoped) { constexpr size_t BYTES_FOR_SIZE = 8; const std::uint64_t BytesForArgs = 2 * sizeof(std::uint32_t); std::vector DescData; @@ -482,7 +483,7 @@ inline UrProperty makeDeviceGlobalInfo(const std::string &Name, std::memcpy(DescData.data() + BYTES_FOR_SIZE + sizeof(TypeSize), &DeviceImageScoped, sizeof(DeviceImageScoped)); - UrProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } @@ -492,8 +493,8 @@ inline UrProperty makeDeviceGlobalInfo(const std::string &Name, /// \param Name is the name of the hostpipe name. /// \param TypeSize is the size of the underlying type in the hostpipe. /// decorated. -inline UrProperty makeHostPipeInfo(const std::string &Name, - const uint32_t TypeSize) { +inline MockProperty makeHostPipeInfo(const std::string &Name, + const uint32_t TypeSize) { constexpr size_t BYTES_FOR_SIZE = 8; const std::uint64_t BytesForArgs = sizeof(std::uint32_t); std::vector DescData; @@ -501,13 +502,13 @@ inline UrProperty makeHostPipeInfo(const std::string &Name, std::memcpy(DescData.data(), &BytesForArgs, sizeof(BytesForArgs)); std::memcpy(DescData.data() + BYTES_FOR_SIZE, &TypeSize, sizeof(TypeSize)); - UrProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } /// Utility function to add aspects to property set. -inline UrProperty makeAspectsProp(const std::vector &Aspects) { +inline MockProperty makeAspectsProp(const std::vector &Aspects) { const size_t BYTES_FOR_SIZE = 8; std::vector ValData(BYTES_FOR_SIZE + Aspects.size() * sizeof(sycl::aspect)); @@ -520,7 +521,7 @@ inline UrProperty makeAspectsProp(const std::vector &Aspects) { return {"aspects", ValData, SYCL_PROPERTY_TYPE_BYTE_ARRAY}; } -inline UrProperty makeReqdWGSizeProp(const std::vector &ReqdWGSize) { +inline MockProperty makeReqdWGSizeProp(const std::vector &ReqdWGSize) { const size_t BYTES_FOR_SIZE = 8; std::vector ValData(BYTES_FOR_SIZE + ReqdWGSize.size() * sizeof(int)); uint64_t ValDataSize = ValData.size(); @@ -534,10 +535,10 @@ inline UrProperty makeReqdWGSizeProp(const std::vector &ReqdWGSize) { } inline void -addDeviceRequirementsProps(UrPropertySet &Props, +addDeviceRequirementsProps(MockPropertySet &Props, const std::vector &Aspects, const std::vector &ReqdWGSize = {}) { - Array Value{makeAspectsProp(Aspects)}; + Array Value{makeAspectsProp(Aspects)}; if (!ReqdWGSize.empty()) Value.push_back(makeReqdWGSizeProp(ReqdWGSize)); Props.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS, std::move(Value)); @@ -545,7 +546,7 @@ addDeviceRequirementsProps(UrPropertySet &Props, inline MockDeviceImage generateDefaultImage(std::initializer_list KernelNames) { - UrPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index ee8023875bac9..83e35aa891a82 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -54,9 +54,10 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; std::vector SpecConstData; - UrProperty SC1 = makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); + MockProperty SC1 = + makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); - UrPropertySet PropSet; + MockPropertySet PropSet; addSpecConstants({SC1}, std::move(SpecConstData), PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp index 115c1586a6488..e0b07306460fc 100644 --- a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp +++ b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp @@ -74,7 +74,7 @@ static void setupCommonMockAPIs(sycl::unittest::UrMock<> &Mock) { static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index 83573c24c2aea..ec9a9c896a7f8 100644 --- a/sycl/unittests/pipes/host_pipe_registration.cpp +++ b/sycl/unittests/pipes/host_pipe_registration.cpp @@ -35,11 +35,11 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { sycl::detail::host_pipe_map::add(Pipe::get_host_ptr(), "test_host_pipe_unique_id"); - UrPropertySet PropSet; - UrProperty HostPipeInfo = + MockPropertySet PropSet; + MockProperty HostPipeInfo = makeHostPipeInfo("test_host_pipe_unique_id", sizeof(int)); PropSet.insert(__SYCL_PROPERTY_SET_SYCL_HOST_PIPES, - Array{std::move(HostPipeInfo)}); + Array{std::move(HostPipeInfo)}); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/program_manager/DynamicLinking.cpp b/sycl/unittests/program_manager/DynamicLinking.cpp index f2406f8784a8b..b883cfe12d497 100644 --- a/sycl/unittests/program_manager/DynamicLinking.cpp +++ b/sycl/unittests/program_manager/DynamicLinking.cpp @@ -37,10 +37,10 @@ KERNEL_INFO(AOTCaseKernel) } // namespace sycl namespace { -sycl::unittest::Array +sycl::unittest::Array createPropertySet(const std::vector &Symbols) { - sycl::unittest::UrPropertySet PropSet; - sycl::unittest::Array Props; + sycl::unittest::MockPropertySet PropSet; + sycl::unittest::Array Props; for (const std::string &Symbol : Symbols) { std::vector Storage(sizeof(uint32_t)); uint32_t Val = 1; @@ -48,7 +48,8 @@ createPropertySet(const std::vector &Symbols) { std::uninitialized_copy(DataPtr, DataPtr + sizeof(uint32_t), Storage.data()); - sycl::unittest::UrProperty Prop(Symbol, Storage, SYCL_PROPERTY_TYPE_UINT32); + sycl::unittest::MockProperty Prop(Symbol, Storage, + SYCL_PROPERTY_TYPE_UINT32); Props.push_back(Prop); } @@ -62,7 +63,7 @@ generateImage(std::initializer_list KernelNames, unsigned char Magic, sycl::detail::ur::DeviceBinaryType BinType = SYCL_DEVICE_BINARY_TYPE_SPIRV) { - sycl::unittest::UrPropertySet PropSet; + sycl::unittest::MockPropertySet PropSet; if (!ExportedSymbols.empty()) PropSet.insert(__SYCL_PROPERTY_SET_SYCL_EXPORTED_SYMBOLS, createPropertySet(ExportedSymbols)); diff --git a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp index 312d0c4ddfd2d..4ce5c0e6a7363 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -48,11 +48,11 @@ static sycl::unittest::MockDeviceImage generateEAMTestKernelImage() { // Eliminated arguments are 1st and 3rd. std::vector KernelEAM{0b00000101}; - UrProperty EAMKernelPOI = makeKernelParamOptInfo( + MockProperty EAMKernelPOI = makeKernelParamOptInfo( EAMTestKernelName, EAMTestKernelNumArgs, KernelEAM); - Array ImgKPOI{std::move(EAMKernelPOI)}; + Array ImgKPOI{std::move(EAMKernelPOI)}; - UrPropertySet PropSet; + MockPropertySet PropSet; PropSet.insert(__SYCL_PROPERTY_SET_KERNEL_PARAM_OPT_INFO, std::move(ImgKPOI)); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data @@ -73,7 +73,7 @@ static sycl::unittest::MockDeviceImage generateEAMTestKernelImage() { static sycl::unittest::MockDeviceImage generateEAMTestKernel2Image() { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{6, 7, 8, 9, 10, 11}; // Random data diff --git a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp index 0944acca31559..fcdafd2b2a700 100644 --- a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp +++ b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp @@ -61,12 +61,12 @@ generateEAMTestKernelImage(std::string _cmplOptions, std::string _lnkOptions) { using namespace sycl::unittest; std::vector KernelEAM1{0b00000101}; - UrProperty EAMKernelPOI = + MockProperty EAMKernelPOI = makeKernelParamOptInfo(sycl::detail::KernelInfo::getName(), EAMTestKernelNumArgs1, KernelEAM1); - Array ImgKPOI{std::move(EAMKernelPOI)}; + Array ImgKPOI{std::move(EAMKernelPOI)}; - UrPropertySet PropSet; + MockPropertySet PropSet; PropSet.insert(__SYCL_PROPERTY_SET_KERNEL_PARAM_OPT_INFO, std::move(ImgKPOI)); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index 9c2415504efeb..10835a938b9e7 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -105,7 +105,7 @@ struct KernelInfo static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; - UrPropertySet PropSet; + MockPropertySet PropSet; addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data From e0d7a7832d0daac4cd7e3025d58f706f03110827 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Sun, 28 Jul 2024 02:31:22 -0700 Subject: [PATCH 5/9] Rename UrOffloadEntry -> MockOffloadEntry --- sycl/unittests/Extensions/DeviceGlobal.cpp | 4 ++-- sycl/unittests/Extensions/USMMemcpy2D.cpp | 2 +- .../VirtualFunctions/RuntimeLinking.cpp | 2 +- sycl/unittests/SYCL2020/IsCompatible.cpp | 2 +- sycl/unittests/SYCL2020/KernelBundle.cpp | 2 +- .../SYCL2020/KernelBundleStateFiltering.cpp | 2 +- sycl/unittests/SYCL2020/KernelID.cpp | 2 +- .../SYCL2020/SpecializationConstant.cpp | 2 +- sycl/unittests/assert/assert.cpp | 4 ++-- sycl/unittests/helpers/MockDeviceImage.hpp | 23 ++++++++++--------- sycl/unittests/kernel-and-program/Cache.cpp | 2 +- .../kernel-and-program/KernelBuildOptions.cpp | 2 +- .../pipes/host_pipe_registration.cpp | 2 +- .../program_manager/DynamicLinking.cpp | 2 +- .../arg_mask/EliminatedArgMask.cpp | 4 ++-- .../passing_link_and_compile_options.cpp | 2 +- .../scheduler/CommandsWaitForEvents.cpp | 2 +- 17 files changed, 31 insertions(+), 30 deletions(-) diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index 43fb56b39424c..e61afbdc5dc09 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -69,7 +69,7 @@ static sycl::unittest::MockDeviceImage generateDeviceGlobalImage() { std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - Array Entries = + Array Entries = makeEmptyKernels({DeviceGlobalTestKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format @@ -100,7 +100,7 @@ static sycl::unittest::MockDeviceImage generateDeviceGlobalImgScopeImage() { std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - Array Entries = + Array Entries = makeEmptyKernels({DeviceGlobalImgScopeTestKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index 2860ac7603de7..0b2b9d09f7ddb 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -132,7 +132,7 @@ static sycl::unittest::MockDeviceImage generateMemopsImage() { std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - Array Entries = makeEmptyKernels( + Array Entries = makeEmptyKernels( {USMFillHelperKernelNameLong, USMFillHelperKernelNameChar, USMMemcpyHelperKernelNameLong, USMMemcpyHelperKernelNameChar}); diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index 3565a1440ab8a..9c9f8d8f257a7 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -69,7 +69,7 @@ generateImage(std::initializer_list KernelNames, std::vector Bin{Magic}; - sycl::unittest::Array Entries = + sycl::unittest::Array Entries = sycl::unittest::makeEmptyKernels(KernelNames); sycl::unittest::MockDeviceImage Img{ diff --git a/sycl/unittests/SYCL2020/IsCompatible.cpp b/sycl/unittests/SYCL2020/IsCompatible.cpp index 88836fb4378de..62941336a220f 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -33,7 +33,7 @@ generateDefaultImage(std::initializer_list KernelNames, std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index 763536eb123ed..0abc6f72b1dd9 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -37,7 +37,7 @@ generateDefaultImage(std::initializer_list KernelNames, std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{BinaryType, // Format DeviceTargetSpec, diff --git a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp index c92e3062bd7d3..4ab308b44cfae 100644 --- a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp +++ b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp @@ -46,7 +46,7 @@ generateDefaultImage(std::initializer_list KernelNames, static unsigned char NImage = 0; std::vector Bin{NImage++}; - Array Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{BinaryType, // Format DeviceTargetSpec, diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index 633cc03f96748..ed6cde0c90e3c 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -55,7 +55,7 @@ generateDefaultImage(std::initializer_list Kernels) { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels(Kernels); + Array Entries = makeEmptyKernels(Kernels); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index c7d7cb593073c..19d606e29623f 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -50,7 +50,7 @@ static sycl::unittest::MockDeviceImage generateImageWithSpecConsts() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = + Array Entries = makeEmptyKernels({"SpecializationConstant_TestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 540930a8a1c21..3957628931b2e 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -86,7 +86,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels({KernelName}); + Array Entries = makeEmptyKernels({KernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec @@ -109,7 +109,7 @@ static sycl::unittest::MockDeviceImage generateCopierKernelImage() { std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - Array Entries = makeEmptyKernels({CopierKernelName}); + Array Entries = makeEmptyKernels({CopierKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index 6575d94eaa76a..8a56e90e3043d 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -72,22 +72,23 @@ class MockProperty { }; /// Convinience wrapper for _ur_offload_entry_struct. -class UrOffloadEntry { +class MockOffloadEntry { public: using NativeType = _sycl_offload_entry_struct; - UrOffloadEntry(const std::string &Name, std::vector Data, int32_t Flags) + MockOffloadEntry(const std::string &Name, std::vector Data, + int32_t Flags) : MName(Name), MData(std::move(Data)), MFlags(Flags) { updateNativeType(); } - UrOffloadEntry(const UrOffloadEntry &Src) { + MockOffloadEntry(const MockOffloadEntry &Src) { MName = Src.MName; MData = Src.MData; MFlags = Src.MFlags; updateNativeType(); } - UrOffloadEntry &operator=(const UrOffloadEntry &Src) { + MockOffloadEntry &operator=(const MockOffloadEntry &Src) { MName = Src.MName; MData = Src.MData; MFlags = Src.MFlags; @@ -231,7 +232,7 @@ class MockDeviceImage { const std::string &CompileOptions, const std::string &LinkOptions, std::vector Manifest, std::vector Binary, - Array OffloadEntries, + Array OffloadEntries, MockPropertySet PropertySet) : MVersion(Version), MKind(Kind), MFormat(Format), MDeviceTargetSpec(DeviceTargetSpec), MCompileOptions(CompileOptions), @@ -244,7 +245,7 @@ class MockDeviceImage { const std::string &CompileOptions, const std::string &LinkOptions, std::vector Binary, - Array OffloadEntries, + Array OffloadEntries, MockPropertySet PropertySet) : MockDeviceImage(SYCL_DEVICE_BINARY_VERSION, SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, Format, @@ -281,7 +282,7 @@ class MockDeviceImage { std::string MLinkOptions; std::vector MManifest; std::vector MBinary; - Array MOffloadEntries; + Array MOffloadEntries; MockPropertySet MPropertySet; }; @@ -432,12 +433,12 @@ inline void addESIMDFlag(MockPropertySet &Props) { } /// Utility function to generate offload entries for kernels without arguments. -inline Array +inline Array makeEmptyKernels(std::initializer_list KernelNames) { - Array Entries; + Array Entries; for (const auto &Name : KernelNames) { - UrOffloadEntry E{Name, {}, 0}; + MockOffloadEntry E{Name, {}, 0}; Entries.push_back(std::move(E)); } return Entries; @@ -550,7 +551,7 @@ generateDefaultImage(std::initializer_list KernelNames) { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index 83e35aa891a82..f7b7922faa8e0 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -62,7 +62,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = + Array Entries = makeEmptyKernels({"CacheTestKernel", "CacheTestKernel2"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format diff --git a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp index e0b07306460fc..e34b871c26a50 100644 --- a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp +++ b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp @@ -78,7 +78,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels({"BuildOptsTestKernel"}); + Array Entries = makeEmptyKernels({"BuildOptsTestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index ec9a9c896a7f8..c7e605daf2be2 100644 --- a/sycl/unittests/pipes/host_pipe_registration.cpp +++ b/sycl/unittests/pipes/host_pipe_registration.cpp @@ -43,7 +43,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels({"TestKernel"}); + Array Entries = makeEmptyKernels({"TestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/program_manager/DynamicLinking.cpp b/sycl/unittests/program_manager/DynamicLinking.cpp index b883cfe12d497..29c48f3100175 100644 --- a/sycl/unittests/program_manager/DynamicLinking.cpp +++ b/sycl/unittests/program_manager/DynamicLinking.cpp @@ -72,7 +72,7 @@ generateImage(std::initializer_list KernelNames, createPropertySet(ImportedSymbols)); std::vector Bin{Magic}; - sycl::unittest::Array Entries = + sycl::unittest::Array Entries = sycl::unittest::makeEmptyKernels(KernelNames); sycl::unittest::MockDeviceImage Img{ diff --git a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp index 4ce5c0e6a7363..015b9465a08cb 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -57,7 +57,7 @@ static sycl::unittest::MockDeviceImage generateEAMTestKernelImage() { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = makeEmptyKernels({EAMTestKernelName}); + Array Entries = makeEmptyKernels({EAMTestKernelName}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec @@ -77,7 +77,7 @@ static sycl::unittest::MockDeviceImage generateEAMTestKernel2Image() { std::vector Bin{6, 7, 8, 9, 10, 11}; // Random data - Array Entries = makeEmptyKernels({EAMTestKernel2Name}); + Array Entries = makeEmptyKernels({EAMTestKernel2Name}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec diff --git a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp index fcdafd2b2a700..89c03b1679e84 100644 --- a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp +++ b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp @@ -71,7 +71,7 @@ generateEAMTestKernelImage(std::string _cmplOptions, std::string _lnkOptions) { std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = + Array Entries = makeEmptyKernels({sycl::detail::KernelInfo::getName()}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index 10835a938b9e7..7e65b65c264ba 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -109,7 +109,7 @@ static sycl::unittest::MockDeviceImage generateDefaultImage() { addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - Array Entries = + Array Entries = makeEmptyKernels({"StreamAUXCmdsWait_TestKernel"}); MockDeviceImage Img{SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format From 150ee47420e25ddb44ca79b35a813c897ae84bc6 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 30 Jul 2024 05:19:03 -0700 Subject: [PATCH 6/9] Fix formatting and drop UR mentions --- sycl/unittests/helpers/MockDeviceImage.hpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index 8a56e90e3043d..5393187f9b8a0 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -1,11 +1,15 @@ -//==------------- MockDeviceImage.hpp --- UR mock image unit testing library -//-------==// +//==------------------------ MockDeviceImage.hpp ---------------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// +// +// Collection of helper classes which allow to mock device images in unit-tests +// that are provided by the SYCL compiler in regular flow. +// +//===----------------------------------------------------------------------===// #pragma once @@ -13,7 +17,6 @@ #include #include #include -#include #include @@ -22,16 +25,16 @@ inline namespace _V1 { namespace unittest { using namespace sycl::detail; -/// Convinience wrapper around _ur_device_binary_property_struct. +/// Convinience wrapper around _sycl_device_binary_property_struct. class MockProperty { public: using NativeType = _sycl_device_binary_property_struct; - /// Constructs a UR property. + /// Constructs a property. /// /// \param Name is a property name. /// \param Data is a vector of raw property value bytes. - /// \param Type is one of ur_property_type values. + /// \param Type is one of sycl_property_type values. MockProperty(const std::string &Name, std::vector Data, uint32_t Type) : MName(Name), MData(std::move(Data)), MType(Type) { updateNativeType(); @@ -71,7 +74,7 @@ class MockProperty { NativeType MNative; }; -/// Convinience wrapper for _ur_offload_entry_struct. +/// Convinience wrapper for _sycl_offload_entry_struct. class MockOffloadEntry { public: using NativeType = _sycl_offload_entry_struct; @@ -111,7 +114,7 @@ class MockOffloadEntry { NativeType MNative; }; -/// Generic array of UR entries. +/// Generic array of Mock entries. template class Array { public: explicit Array(std::vector Entries) : MMockEntries(std::move(Entries)) { @@ -194,7 +197,8 @@ class MockPropertySet { /// Adds a new array of properties to the set. /// - /// \param Name is a property array name. See ur.hpp for list of known names. + /// \param Name is a property array name. See compiler.hpp for list of known + /// names. /// \param Props is an array of property values. void insert(const std::string &Name, Array Props) { MNames.push_back(Name); @@ -222,7 +226,7 @@ class MockPropertySet { std::vector<_sycl_device_binary_property_set_struct> MProperties; }; -/// Convenience wrapper around UR internal structures, that manages UR binary +/// Convenience wrapper around internal structures, that manages binary /// image data lifecycle. class MockDeviceImage { public: From d670e9a25e398300ab350a496bfd447418c6728b Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Wed, 23 Oct 2024 04:06:23 -0700 Subject: [PATCH 7/9] Apply clang-format --- sycl/unittests/helpers/MockDeviceImage.hpp | 13 +++++++------ sycl/unittests/program_manager/CompileTarget.cpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index ee66809acddeb..6ac9e59d5ecab 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -236,11 +236,12 @@ class MockDeviceImage { private: /// Constructs an arbitrary device image. MockDeviceImage(uint16_t Version, uint8_t Kind, uint8_t Format, - const std::string &DeviceTargetSpec, - const std::string &CompileOptions, const std::string &LinkOptions, - std::vector &&Manifest, std::vector &&Binary, - internal::LifetimeExtender OffloadEntries, - MockPropertySet PropertySet) + const std::string &DeviceTargetSpec, + const std::string &CompileOptions, + const std::string &LinkOptions, std::vector &&Manifest, + std::vector &&Binary, + internal::LifetimeExtender OffloadEntries, + MockPropertySet PropertySet) : MVersion(Version), MKind(Kind), MFormat(Format), MDeviceTargetSpec(DeviceTargetSpec), MCompileOptions(CompileOptions), MLinkOptions(LinkOptions), MManifest(std::move(Manifest)), @@ -280,7 +281,7 @@ class MockDeviceImage { /// - empty compile and link options /// - placeholder binary data MockDeviceImage(std::vector &&OffloadEntries, - MockPropertySet PropertySet) + MockPropertySet PropertySet) : MockDeviceImage( SYCL_DEVICE_BINARY_VERSION, SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, SYCL_DEVICE_BINARY_TYPE_SPIRV, __SYCL_DEVICE_BINARY_TARGET_SPIRV64, diff --git a/sycl/unittests/program_manager/CompileTarget.cpp b/sycl/unittests/program_manager/CompileTarget.cpp index aa53cf6a8f5cc..d598d6b2f1cf3 100644 --- a/sycl/unittests/program_manager/CompileTarget.cpp +++ b/sycl/unittests/program_manager/CompileTarget.cpp @@ -25,7 +25,7 @@ generateImageWithCompileTarget(std::string KernelName, std::vector Data(8 + CompileTarget.size()); std::copy(CompileTarget.begin(), CompileTarget.end(), Data.data() + 8); MockProperty CompileTargetProperty("compile_target", Data, - SYCL_PROPERTY_TYPE_BYTE_ARRAY); + SYCL_PROPERTY_TYPE_BYTE_ARRAY); MockPropertySet PropSet; PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS, std::move(CompileTargetProperty)); From 3eafbcb1590f8c31017d47e52d59ed54944f380e Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Wed, 30 Oct 2024 08:21:12 -0700 Subject: [PATCH 8/9] Fix after merge --- sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index b72d78e6e1881..312f730317d40 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -49,7 +49,7 @@ KERNEL_INFO(KernelG) static sycl::unittest::MockDeviceImage generateImage(std::initializer_list KernelNames, const std::string &VFSets, bool UsesVFSets, unsigned char Magic) { - sycl::unittest::UrPropertySet PropSet; + sycl::unittest::MockPropertySet PropSet; std::vector Props; uint64_t PropSize = VFSets.size(); std::vector Storage(/* bytes for size */ 8 + PropSize + From 770e7ad04a549568d87d718baf47e3a86cdafb73 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Wed, 30 Oct 2024 08:49:02 -0700 Subject: [PATCH 9/9] Apply clang-format --- sycl/unittests/Extensions/DeviceGlobal.cpp | 2 +- sycl/unittests/Extensions/USMMemcpy2D.cpp | 2 +- sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp | 2 +- sycl/unittests/SYCL2020/IsCompatible.cpp | 2 +- sycl/unittests/SYCL2020/KernelBundle.cpp | 2 +- sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp | 2 +- sycl/unittests/SYCL2020/KernelID.cpp | 2 +- sycl/unittests/SYCL2020/SpecializationConstant.cpp | 2 +- sycl/unittests/assert/assert.cpp | 2 +- sycl/unittests/buffer/KernelArgMemObj.cpp | 2 +- sycl/unittests/helpers/MockDeviceImage.hpp | 3 ++- sycl/unittests/helpers/TestKernel.hpp | 2 +- sycl/unittests/kernel-and-program/Cache.cpp | 2 +- sycl/unittests/kernel-and-program/KernelBuildOptions.cpp | 2 +- sycl/unittests/kernel-and-program/MultipleDevsCache.cpp | 2 +- sycl/unittests/kernel-and-program/OutOfResources.cpp | 2 +- sycl/unittests/pipes/host_pipe_registration.cpp | 2 +- sycl/unittests/program_manager/CompileTarget.cpp | 2 +- sycl/unittests/program_manager/DynamicLinking.cpp | 2 +- sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp | 2 +- .../program_manager/passing_link_and_compile_options.cpp | 2 +- sycl/unittests/queue/GetProfilingInfo.cpp | 2 +- sycl/unittests/scheduler/CommandsWaitForEvents.cpp | 2 +- 23 files changed, 24 insertions(+), 23 deletions(-) diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index c5768bb025cef..222970aa1d959 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -11,8 +11,8 @@ #include "detail/context_impl.hpp" #include "detail/kernel_program_cache.hpp" -#include #include +#include #include #include diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index 3db8108dbc49a..880ed9bd69385 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -10,8 +10,8 @@ #include -#include #include +#include #include #include diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index 312f730317d40..61e0c5f5f32a5 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -2,9 +2,9 @@ #include "ur_mock_helpers.hpp" #include +#include #include #include -#include #include #include diff --git a/sycl/unittests/SYCL2020/IsCompatible.cpp b/sycl/unittests/SYCL2020/IsCompatible.cpp index 8c8d7fb939593..7a791afe301e2 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -1,7 +1,7 @@ #include -#include #include +#include #include #include diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index 66dfeff38bdc4..5ffe4ecbc341a 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -10,8 +10,8 @@ #include #include -#include #include +#include #include #include diff --git a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp index 37e8a6b9e13c8..23610892d041b 100644 --- a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp +++ b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp @@ -10,8 +10,8 @@ #include #include -#include #include +#include #include #include diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index b81a886d346e7..6cb4a0a316d42 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -8,8 +8,8 @@ #include -#include #include +#include #include #include diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index a6fbc0da7295d..01dd78a6795bf 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -11,8 +11,8 @@ #include #include -#include #include +#include #include #include diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 77320f007a6fd..b45996238358f 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -28,8 +28,8 @@ #include #include -#include #include +#include #include #include diff --git a/sycl/unittests/buffer/KernelArgMemObj.cpp b/sycl/unittests/buffer/KernelArgMemObj.cpp index 57b25980ff03b..2dd1eabfca9a1 100644 --- a/sycl/unittests/buffer/KernelArgMemObj.cpp +++ b/sycl/unittests/buffer/KernelArgMemObj.cpp @@ -8,8 +8,8 @@ #include -#include #include +#include #include class TestKernelWithMemObj; diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index 6ac9e59d5ecab..0b6379dcd858e 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -454,7 +454,8 @@ inline void setKernelUsesAssert(const std::vector &Names, /// /// This function overrides the default spec constant values. inline void addSpecConstants(std::vector &&SpecConstants, - std::vector ValData, MockPropertySet &Props) { + std::vector ValData, + MockPropertySet &Props) { Props.insert(__SYCL_PROPERTY_SET_SPEC_CONST_MAP, std::move(SpecConstants)); MockProperty Prop{"all", std::move(ValData), SYCL_PROPERTY_TYPE_BYTE_ARRAY}; diff --git a/sycl/unittests/helpers/TestKernel.hpp b/sycl/unittests/helpers/TestKernel.hpp index 3ee2ad5833ec8..722a6e825a55f 100644 --- a/sycl/unittests/helpers/TestKernel.hpp +++ b/sycl/unittests/helpers/TestKernel.hpp @@ -8,8 +8,8 @@ #pragma once -#include "MockKernelInfo.hpp" #include "MockDeviceImage.hpp" +#include "MockKernelInfo.hpp" template class TestKernel; diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index 6990e63c4fcf3..92f76e7f097f1 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -14,8 +14,8 @@ #include "detail/context_impl.hpp" #include "detail/kernel_program_cache.hpp" #include "sycl/detail/ur.hpp" -#include #include +#include #include #include diff --git a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp index 50abf06d1c7bb..2cf52e27cd648 100644 --- a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp +++ b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp @@ -11,8 +11,8 @@ #define __SYCL_INTERNAL_API #endif -#include #include +#include #include #include diff --git a/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp b/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp index 2b5c7713bacac..6a635c90b7965 100644 --- a/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp +++ b/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp @@ -11,8 +11,8 @@ #include "detail/context_impl.hpp" #include "detail/kernel_bundle_impl.hpp" #include "detail/kernel_program_cache.hpp" -#include #include +#include #include #include diff --git a/sycl/unittests/kernel-and-program/OutOfResources.cpp b/sycl/unittests/kernel-and-program/OutOfResources.cpp index 8f31d4626e4cf..ed2ed0cd9f42d 100644 --- a/sycl/unittests/kernel-and-program/OutOfResources.cpp +++ b/sycl/unittests/kernel-and-program/OutOfResources.cpp @@ -11,8 +11,8 @@ #include "detail/context_impl.hpp" #include "detail/kernel_bundle_impl.hpp" #include "detail/kernel_program_cache.hpp" -#include #include +#include #include #include diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index 56c5878edb999..c821ddf4e09e9 100644 --- a/sycl/unittests/pipes/host_pipe_registration.cpp +++ b/sycl/unittests/pipes/host_pipe_registration.cpp @@ -12,8 +12,8 @@ #include #include #include -#include #include +#include #include #include diff --git a/sycl/unittests/program_manager/CompileTarget.cpp b/sycl/unittests/program_manager/CompileTarget.cpp index d598d6b2f1cf3..4d0bfaae055c1 100644 --- a/sycl/unittests/program_manager/CompileTarget.cpp +++ b/sycl/unittests/program_manager/CompileTarget.cpp @@ -8,8 +8,8 @@ #define SYCL2020_DISABLE_DEPRECATION_WARNINGS -#include #include +#include #include #include diff --git a/sycl/unittests/program_manager/DynamicLinking.cpp b/sycl/unittests/program_manager/DynamicLinking.cpp index 6b5f16dc68a06..82b86843b49c3 100644 --- a/sycl/unittests/program_manager/DynamicLinking.cpp +++ b/sycl/unittests/program_manager/DynamicLinking.cpp @@ -1,8 +1,8 @@ #include +#include #include #include -#include #include #include diff --git a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp index 70ab2bf7d7898..0d920590c6e15 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -12,8 +12,8 @@ #include #include -#include #include +#include #include #include diff --git a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp index 747db5422d729..4deac120a133e 100644 --- a/sycl/unittests/program_manager/passing_link_and_compile_options.cpp +++ b/sycl/unittests/program_manager/passing_link_and_compile_options.cpp @@ -10,8 +10,8 @@ #include -#include #include +#include #include #include diff --git a/sycl/unittests/queue/GetProfilingInfo.cpp b/sycl/unittests/queue/GetProfilingInfo.cpp index 1889c6d742eaa..9c011e16ace8a 100644 --- a/sycl/unittests/queue/GetProfilingInfo.cpp +++ b/sycl/unittests/queue/GetProfilingInfo.cpp @@ -15,9 +15,9 @@ #include +#include #include #include -#include #include #include diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index 6b7c1750f581c..0d59ec13795cb 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -9,8 +9,8 @@ #include "SchedulerTest.hpp" #include "SchedulerTestUtils.hpp" #include "ur_mock_helpers.hpp" -#include #include +#include #include #include