diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index d7066f60359e..1ba9e07b68c5 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -67,18 +67,10 @@ static sycl::unittest::UrImage generateDeviceGlobalImage() { PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS, std::vector{std::move(DevGlobInfo)}); - std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } @@ -98,18 +90,10 @@ static sycl::unittest::UrImage generateDeviceGlobalImgScopeImage() { PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS, std::vector{std::move(DevGlobInfo)}); - std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index 60d8681ad4a8..8264b7c27ed6 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -125,30 +125,10 @@ struct KernelInfo> } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage generateMemopsImage() { - using namespace sycl::unittest; - - UrPropertySet PropSet; - - std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - - std::vector Entries = makeEmptyKernels( - {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)}; - - return Img; -} - namespace { -sycl::unittest::UrImage Imgs[] = {generateMemopsImage()}; +sycl::unittest::UrImage Imgs[] = {sycl::unittest::generateDefaultImage( + {USMFillHelperKernelNameLong, USMFillHelperKernelNameChar, + USMMemcpyHelperKernelNameLong, USMMemcpyHelperKernelNameChar})}; sycl::unittest::UrImageArray<1> ImgArray{Imgs}; ur_context_info_t LastMemopsQuery = UR_CONTEXT_INFO_NUM_DEVICES; diff --git a/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp b/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp index b3b974126689..0709e88c3fba 100644 --- a/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp +++ b/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp @@ -8,7 +8,6 @@ #include -#include #include #include diff --git a/sycl/unittests/SYCL2020/IsCompatible.cpp b/sycl/unittests/SYCL2020/IsCompatible.cpp index 43f73e76485c..12f54a42d3f9 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -24,23 +24,15 @@ MOCK_INTEGRATION_HEADER(TestKernelACC) static sycl::unittest::UrImage 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; addDeviceRequirementsProps(PropSet, Aspects, ReqdWGSize); - - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index e87d93cdcf6c..87f01caf2a87 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -47,30 +47,10 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace _V1 } // namespace sycl -static sycl::unittest::UrImage -generateDefaultImage(std::initializer_list Kernels) { - using namespace sycl::unittest; - - UrPropertySet PropSet; - - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - - std::vector 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)}; - - return Img; -} - static sycl::unittest::UrImage Imgs[2] = { - generateDefaultImage({"KernelID_TestKernel1", "KernelID_TestKernel3"}), - generateDefaultImage( + sycl::unittest::generateDefaultImage( + {"KernelID_TestKernel1", "KernelID_TestKernel3"}), + sycl::unittest::generateDefaultImage( {"KernelID_TestKernel2", "_ZTSN2cl4sycl6detail23__sycl_service_kernel__14ServiceKernel1"})}; static sycl::unittest::UrImageArray<2> ImgArray{Imgs}; diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 4c52e3a307e9..a0bcc5f9c7ef 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -47,17 +47,9 @@ static sycl::unittest::UrImage generateImageWithSpecConsts() { UrPropertySet PropSet; addSpecConstants({SC1, SC2}, std::move(SpecConstData), PropSet); - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } diff --git a/sycl/unittests/accessor/AccessorPlaceholder.cpp b/sycl/unittests/accessor/AccessorPlaceholder.cpp index 045ae6402d22..45b078984c84 100644 --- a/sycl/unittests/accessor/AccessorPlaceholder.cpp +++ b/sycl/unittests/accessor/AccessorPlaceholder.cpp @@ -1,6 +1,5 @@ #include -#include #include #include #include diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 1541581f216a..0e69d5c51084 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -84,17 +84,9 @@ static sycl::unittest::UrImage generateDefaultImage() { setKernelUsesAssert({KernelName}, PropSet); - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } @@ -107,17 +99,9 @@ static sycl::unittest::UrImage generateCopierKernelImage() { UrPropertySet PropSet; - std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } diff --git a/sycl/unittests/helpers/UrImage.hpp b/sycl/unittests/helpers/UrImage.hpp index 1903a99cb30d..5b06af278035 100644 --- a/sycl/unittests/helpers/UrImage.hpp +++ b/sycl/unittests/helpers/UrImage.hpp @@ -266,6 +266,29 @@ class UrImage { internal::LifetimeExtender(std::move(OffloadEntries)), std::move(PropertySet)) {} + /// Constructs a mock SYCL device image with: + /// - the latest version + /// - SPIR-V format + /// - empty compile and link options + /// - placeholder binary data + UrImage(std::vector &&OffloadEntries, + UrPropertySet PropertySet) + : UrImage( + SYCL_DEVICE_BINARY_VERSION, SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, + SYCL_DEVICE_BINARY_TYPE_SPIRV, __SYCL_DEVICE_BINARY_TARGET_SPIRV64, + "", "", {}, std::move(std::vector{1, 2, 3, 4, 5}), + internal::LifetimeExtender(std::move(OffloadEntries)), + std::move(PropertySet)) {} + + /// Constructs a mock SYCL device image with: + /// - the latest version + /// - SPIR-V format + /// - empty compile and link options + /// - placeholder binary data + /// - no properties + UrImage(std::vector &&OffloadEntries) + : UrImage(std::move(OffloadEntries), {}) {} + sycl_device_binary_struct convertToNativeType() { return sycl_device_binary_struct{ MVersion, @@ -575,7 +598,6 @@ generateDefaultImage(std::initializer_list KernelNames) { std::move(Bin), std::move(Entries), std::move(PropSet)}; - return Img; } diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index 20d1a72939e5..3d2323c3d496 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -59,18 +59,10 @@ static sycl::unittest::UrImage generateDefaultImage() { UrPropertySet PropSet; addSpecConstants({SC1}, std::move(SpecConstData), PropSet); - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index 93646e767207..69dd04a4b969 100644 --- a/sycl/unittests/pipes/host_pipe_registration.cpp +++ b/sycl/unittests/pipes/host_pipe_registration.cpp @@ -41,17 +41,9 @@ static sycl::unittest::UrImage generateDefaultImage() { PropSet.insert(__SYCL_PROPERTY_SET_SYCL_HOST_PIPES, std::vector{std::move(HostPipeInfo)}); - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } diff --git a/sycl/unittests/program_manager/BuildLog.cpp b/sycl/unittests/program_manager/BuildLog.cpp index fc4ff8abbbde..c204c603655a 100644 --- a/sycl/unittests/program_manager/BuildLog.cpp +++ b/sycl/unittests/program_manager/BuildLog.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/sycl/unittests/program_manager/SubDevices.cpp b/sycl/unittests/program_manager/SubDevices.cpp index 26d5b4cf148a..602c16c3a544 100644 --- a/sycl/unittests/program_manager/SubDevices.cpp +++ b/sycl/unittests/program_manager/SubDevices.cpp @@ -8,7 +8,6 @@ #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 e252e5d42c48..23ebfda43bd2 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -63,37 +63,9 @@ static sycl::unittest::UrImage generateEAMTestKernelImage() { 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 - std::vector 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)}; - - return Img; -} - -static sycl::unittest::UrImage generateEAMTestKernel2Image() { - using namespace sycl::unittest; - - UrPropertySet PropSet; - - std::vector Bin{6, 7, 8, 9, 10, 11}; // Random data - - std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } @@ -110,23 +82,16 @@ static sycl::unittest::UrImage generateEAMTestKernel3Image() { 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 - std::vector Entries = makeEmptyKernels({EAMTestKernel3Name}); - 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } static sycl::unittest::UrImage EAMImg = generateEAMTestKernelImage(); -static sycl::unittest::UrImage EAM2Img = generateEAMTestKernel2Image(); +static sycl::unittest::UrImage EAM2Img = + sycl::unittest::generateDefaultImage({EAMTestKernel2Name}); static sycl::unittest::UrImage EAM3Img = generateEAMTestKernel3Image(); static sycl::unittest::UrImageArray<1> EAMImgArray{&EAMImg}; static sycl::unittest::UrImageArray<1> EAM2ImgArray{&EAM2Img}; diff --git a/sycl/unittests/program_manager/itt_annotations.cpp b/sycl/unittests/program_manager/itt_annotations.cpp index edcb9a9baf88..f7c70a996b0e 100644 --- a/sycl/unittests/program_manager/itt_annotations.cpp +++ b/sycl/unittests/program_manager/itt_annotations.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index abfa41de09f8..355f8985acf6 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -107,18 +107,11 @@ static sycl::unittest::UrImage generateDefaultImage() { UrPropertySet PropSet; addESIMDFlag(PropSet); - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data std::vector 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)}; + UrImage Img(std::move(Entries), std::move(PropSet)); return Img; } diff --git a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp index c37753735c65..cf0c91e1478c 100644 --- a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp +++ b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp @@ -10,7 +10,6 @@ #include "SchedulerTestUtils.hpp" #include -#include #include #include diff --git a/sycl/unittests/scheduler/RequiredWGSize.cpp b/sycl/unittests/scheduler/RequiredWGSize.cpp index 3cfa1958ed52..576c73d630eb 100644 --- a/sycl/unittests/scheduler/RequiredWGSize.cpp +++ b/sycl/unittests/scheduler/RequiredWGSize.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include diff --git a/sycl/unittests/stream/stream.cpp b/sycl/unittests/stream/stream.cpp index 7fee0309f84c..790831862ae1 100644 --- a/sycl/unittests/stream/stream.cpp +++ b/sycl/unittests/stream/stream.cpp @@ -8,7 +8,6 @@ #include -#include #include #include diff --git a/sycl/unittests/windows/dllmain.cpp b/sycl/unittests/windows/dllmain.cpp index f99364fe1172..79c41981f426 100644 --- a/sycl/unittests/windows/dllmain.cpp +++ b/sycl/unittests/windows/dllmain.cpp @@ -12,7 +12,6 @@ * distinct binary executable. */ -#include #include #include