diff --git a/sycl/unittests/Extensions/DeviceGlobal.cpp b/sycl/unittests/Extensions/DeviceGlobal.cpp index d4553128e1740..99e5ac0381aa5 100644 --- a/sycl/unittests/Extensions/DeviceGlobal.cpp +++ b/sycl/unittests/Extensions/DeviceGlobal.cpp @@ -13,7 +13,7 @@ #include "detail/kernel_program_cache.hpp" #include -#include +#include #include #include @@ -59,7 +59,7 @@ struct KernelInfo } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage generateDeviceGlobalImage() { +static sycl::unittest::MockDeviceImage generateDeviceGlobalImage() { using namespace sycl::unittest; // Call device global map initializer explicitly to mimic the integration @@ -67,29 +67,30 @@ static sycl::unittest::PiImage generateDeviceGlobalImage() { sycl::detail::device_global_map::add(&DeviceGlobal, DeviceGlobalName); // Insert remaining device global info into the binary. - PiPropertySet PropSet; - PiProperty DevGlobInfo = + MockPropertySet PropSet; + MockProperty DevGlobInfo = makeDeviceGlobalInfo(DeviceGlobalName, sizeof(int) * 2, 0); PropSet.insert(__SYCL_PI_PROPERTY_SET_SYCL_DEVICE_GLOBALS, - PiArray{std::move(DevGlobInfo)}); + Array{std::move(DevGlobInfo)}); std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - PiArray Entries = + Array Entries = makeEmptyKernels({DeviceGlobalTestKernelName}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage generateDeviceGlobalImgScopeImage() { +static sycl::unittest::MockDeviceImage generateDeviceGlobalImgScopeImage() { using namespace sycl::unittest; // Call device global map initializer explicitly to mimic the integration @@ -98,30 +99,31 @@ static sycl::unittest::PiImage generateDeviceGlobalImgScopeImage() { DeviceGlobalImgScopeName); // Insert remaining device global info into the binary. - PiPropertySet PropSet; - PiProperty DevGlobInfo = + MockPropertySet PropSet; + MockProperty DevGlobInfo = makeDeviceGlobalInfo(DeviceGlobalImgScopeName, sizeof(int) * 2, 1); PropSet.insert(__SYCL_PI_PROPERTY_SET_SYCL_DEVICE_GLOBALS, - PiArray{std::move(DevGlobInfo)}); + Array{std::move(DevGlobInfo)}); std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - PiArray Entries = + Array Entries = makeEmptyKernels({DeviceGlobalImgScopeTestKernelName}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } namespace { -sycl::unittest::PiImage Imgs[] = {generateDeviceGlobalImage(), +sycl::unittest::MockDeviceImage Imgs[] = {generateDeviceGlobalImage(), generateDeviceGlobalImgScopeImage()}; sycl::unittest::PiImageArray<2> ImgArray{Imgs}; diff --git a/sycl/unittests/Extensions/USMMemcpy2D.cpp b/sycl/unittests/Extensions/USMMemcpy2D.cpp index 9ed0079378d5a..4d572b9fe87f5 100644 --- a/sycl/unittests/Extensions/USMMemcpy2D.cpp +++ b/sycl/unittests/Extensions/USMMemcpy2D.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include @@ -125,30 +125,31 @@ struct KernelInfo> } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage generateMemopsImage() { +static sycl::unittest::MockDeviceImage generateMemopsImage() { using namespace sycl::unittest; - PiPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - PiArray Entries = makeEmptyKernels( + Array Entries = makeEmptyKernels( {USMFillHelperKernelNameLong, USMFillHelperKernelNameChar, USMMemcpyHelperKernelNameLong, USMMemcpyHelperKernelNameChar}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } namespace { -sycl::unittest::PiImage Imgs[] = {generateMemopsImage()}; +sycl::unittest::MockDeviceImage Imgs[] = {generateMemopsImage()}; sycl::unittest::PiImageArray<1> ImgArray{Imgs}; size_t LastMemopsQuery = 0; diff --git a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp index eadab4ad75e6c..a76bd44dc0fb3 100644 --- a/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp +++ b/sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include @@ -44,11 +44,11 @@ KERNEL_INFO(KernelG) } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage +static sycl::unittest::MockDeviceImage generateImage(std::initializer_list KernelNames, const std::string &VFSets, bool UsesVFSets, unsigned char Magic) { - sycl::unittest::PiPropertySet PropSet; - sycl::unittest::PiArray 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); @@ -59,7 +59,7 @@ generateImage(std::initializer_list KernelNames, Storage.back() = '\0'; const std::string PropName = UsesVFSets ? "uses-virtual-functions-set" : "virtual-functions-set"; - sycl::unittest::PiProperty Prop(PropName, Storage, + sycl::unittest::MockProperty Prop(PropName, Storage, PI_PROPERTY_TYPE_BYTE_ARRAY); Props.push_back(Prop); @@ -68,10 +68,10 @@ generateImage(std::initializer_list KernelNames, std::vector Bin{Magic}; - sycl::unittest::PiArray Entries = + sycl::unittest::Array Entries = sycl::unittest::makeEmptyKernels(KernelNames); - sycl::unittest::PiImage Img{ + sycl::unittest::MockDeviceImage Img{ PI_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec "", // Compile options @@ -102,7 +102,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::PiImage 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), diff --git a/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp b/sycl/unittests/SYCL2020/DeviceGetInfoAspects.cpp index 8e1d5bf7f7cb8..4cf350a6add9f 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 eae77cdf0c8d9..cc056f51ee295 100644 --- a/sycl/unittests/SYCL2020/IsCompatible.cpp +++ b/sycl/unittests/SYCL2020/IsCompatible.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include @@ -22,30 +22,32 @@ MOCK_INTEGRATION_HEADER(TestKernelCPUValidReqdWGSize3D) MOCK_INTEGRATION_HEADER(TestKernelGPU) MOCK_INTEGRATION_HEADER(TestKernelACC) -static sycl::unittest::PiImage +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; - PiPropertySet PropSet; + MockPropertySet PropSet; addDeviceRequirementsProps(PropSet, Aspects, ReqdWGSize); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage 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) diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index 21a8761e4c935..2901632887914 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include @@ -24,22 +24,22 @@ MOCK_INTEGRATION_HEADER(TestKernel) MOCK_INTEGRATION_HEADER(TestKernelExeOnly) MOCK_INTEGRATION_HEADER(TestKernelWithAspects) -static sycl::unittest::PiImage +static sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list KernelNames, pi_device_binary_type BinaryType, const char *DeviceTargetSpec, const std::vector &Aspects = {}) { using namespace sycl::unittest; - PiPropertySet PropSet; + MockPropertySet PropSet; if (!Aspects.empty()) addDeviceRequirementsProps(PropSet, Aspects); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); - PiImage Img{BinaryType, // Format + MockDeviceImage Img{BinaryType, // Format DeviceTargetSpec, "", // Compile options "", // Link options @@ -50,7 +50,7 @@ generateDefaultImage(std::initializer_list KernelNames, return Img; } -static sycl::unittest::PiImage Imgs[] = { +static sycl::unittest::MockDeviceImage Imgs[] = { generateDefaultImage({"TestKernel"}, PI_DEVICE_BINARY_TYPE_SPIRV, __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64), generateDefaultImage({"TestKernelExeOnly"}, PI_DEVICE_BINARY_TYPE_NATIVE, diff --git a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp index 7e008b9809b1a..b5c10c4b35d0d 100644 --- a/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp +++ b/sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include @@ -35,26 +35,26 @@ MOCK_INTEGRATION_HEADER(KernelE) namespace { std::set TrackedImages; -sycl::unittest::PiImage +sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list KernelNames, pi_device_binary_type BinaryType, const char *DeviceTargetSpec) { using namespace sycl::unittest; - PiPropertySet PropSet; + MockPropertySet PropSet; static unsigned char NImage = 0; std::vector Bin{NImage++}; - PiArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); - PiImage 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::PiImage Imgs[] = { +sycl::unittest::MockDeviceImage Imgs[] = { generateDefaultImage({"KernelA", "KernelB"}, PI_DEVICE_BINARY_TYPE_SPIRV, __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64), generateDefaultImage({"KernelA"}, PI_DEVICE_BINARY_TYPE_NATIVE, diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index 1f493404f367f..9698e1602ec1e 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -47,28 +47,29 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage +static sycl::unittest::MockDeviceImage generateDefaultImage(std::initializer_list Kernels) { using namespace sycl::unittest; - PiPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels(Kernels); + Array Entries = makeEmptyKernels(Kernels); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage Imgs[2] = { +static sycl::unittest::MockDeviceImage Imgs[2] = { generateDefaultImage({"KernelID_TestKernel1", "KernelID_TestKernel3"}), generateDefaultImage( {"KernelID_TestKernel2", diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index ccda293aa2474..fb0079b6e1d74 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include @@ -37,33 +37,34 @@ template <> const char *get_spec_constant_symbolic_ID() { } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage generateImageWithSpecConsts() { +static sycl::unittest::MockDeviceImage generateImageWithSpecConsts() { using namespace sycl::unittest; std::vector SpecConstData; - PiProperty SC1 = makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); - PiProperty SC2 = makeSpecConstant(SpecConstData, "SC2", {1}, {0}, {8}); + MockProperty SC1 = makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); + MockProperty SC2 = makeSpecConstant(SpecConstData, "SC2", {1}, {0}, {8}); - PiPropertySet PropSet; + MockPropertySet PropSet; addSpecConstants({SC1, SC2}, std::move(SpecConstData), PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = + Array Entries = makeEmptyKernels({"SpecializationConstant_TestKernel"}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage Img = generateImageWithSpecConsts(); +static sycl::unittest::MockDeviceImage Img = generateImageWithSpecConsts(); static sycl::unittest::PiImageArray<1> ImgArray{&Img}; TEST(SpecializationConstant, DefaultValuesAreSet) { diff --git a/sycl/unittests/accessor/AccessorPlaceholder.cpp b/sycl/unittests/accessor/AccessorPlaceholder.cpp index 611e3fbff8757..975a71832b6e2 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 b94d43925d374..1fdea64070b4f 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -72,56 +72,58 @@ struct KernelInfo<::sycl::detail::__sycl_service_kernel__::AssertInfoCopier> } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; static const std::string KernelName = "TestKernel"; static const std::string CopierKernelName = "_ZTSN2cl4sycl6detail23__sycl_service_kernel__16AssertInfoCopierE"; - PiPropertySet PropSet; + MockPropertySet PropSet; setKernelUsesAssert({KernelName}, PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels({KernelName}); + Array Entries = makeEmptyKernels({KernelName}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage generateCopierKernelImage() { +static sycl::unittest::MockDeviceImage generateCopierKernelImage() { using namespace sycl::unittest; static const std::string CopierKernelName = "_ZTSN2cl4sycl6detail23__sycl_service_kernel__16AssertInfoCopierE"; - PiPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{10, 11, 12, 13, 14, 15}; // Random data - PiArray Entries = makeEmptyKernels({CopierKernelName}); + Array Entries = makeEmptyKernels({CopierKernelName}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -sycl::unittest::PiImage Imgs[] = {generateDefaultImage(), +sycl::unittest::MockDeviceImage Imgs[] = {generateDefaultImage(), generateCopierKernelImage()}; sycl::unittest::PiImageArray<2> ImgArray{Imgs}; diff --git a/sycl/unittests/buffer/KernelArgMemObj.cpp b/sycl/unittests/buffer/KernelArgMemObj.cpp index 7f59cf52d09e2..4f21940b6af9c 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/PiImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp similarity index 81% rename from sycl/unittests/helpers/PiImage.hpp rename to sycl/unittests/helpers/MockDeviceImage.hpp index ee78ab2a65f75..694dccca48a94 100644 --- a/sycl/unittests/helpers/PiImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -1,4 +1,4 @@ -//==------------- PiImage.hpp --- PI mock image unit testing library -------==// +//==----- MockDeviceImage.hpp --- Mock device image for unit testing -------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -19,7 +19,7 @@ namespace sycl { inline namespace _V1 { namespace unittest { /// Convinience wrapper around _pi_device_binary_property_struct. -class PiProperty { +class MockProperty { public: using NativeType = _pi_device_binary_property_struct; @@ -28,21 +28,21 @@ class PiProperty { /// \param Name is a property name. /// \param Data is a vector of raw property value bytes. /// \param Type is one of pi_property_type values. - PiProperty(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; } - PiProperty(const PiProperty &Src) { + MockProperty(const MockProperty &Src) { MName = Src.MName; MData = Src.MData; MType = Src.MType; updateNativeType(); } - PiProperty &operator=(const PiProperty &Src) { + MockProperty &operator=(const MockProperty &Src) { MName = Src.MName; MData = Src.MData; MType = Src.MType; @@ -68,22 +68,23 @@ class PiProperty { }; /// Convinience wrapper for _pi_offload_entry_struct. -class PiOffloadEntry { +class MockOffloadEntry { public: using NativeType = _pi_offload_entry_struct; - PiOffloadEntry(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(); } - PiOffloadEntry(const PiOffloadEntry &Src) { + MockOffloadEntry(const MockOffloadEntry &Src) { MName = Src.MName; MData = Src.MData; MFlags = Src.MFlags; updateNativeType(); } - PiOffloadEntry &operator=(const PiOffloadEntry &Src) { + MockOffloadEntry &operator=(const MockOffloadEntry &Src) { MName = Src.MName; MData = Src.MData; MFlags = Src.MFlags; @@ -106,18 +107,18 @@ class PiOffloadEntry { NativeType MNative; }; -/// Generic array of PI entries. -template class PiArray { +/// Generic array of mock entries. +template class Array { public: - explicit PiArray(std::vector Entries) : MMockEntries(std::move(Entries)) { + explicit Array(std::vector Entries) : MMockEntries(std::move(Entries)) { updateEntries(); } - PiArray(std::initializer_list Entries) : MMockEntries(std::move(Entries)) { + Array(std::initializer_list Entries) : MMockEntries(std::move(Entries)) { updateEntries(); } - PiArray() = default; + Array() = default; void push_back(const T &Entry) { MMockEntries.push_back(Entry); @@ -158,15 +159,15 @@ template class PiArray { }; #ifdef __cpp_deduction_guides -template PiArray(std::vector) -> PiArray; +template Array(std::vector) -> Array; -template PiArray(std::initializer_list) -> PiArray; +template Array(std::initializer_list) -> Array; #endif // __cpp_deduction_guides /// Convenience wrapper for pi_device_binary_property_set. -class PiPropertySet { +class MockPropertySet { public: - PiPropertySet() { + 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 @@ -183,16 +184,16 @@ class PiPropertySet { // 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. - PiProperty DeviceLibReqMask("", Data, PI_PROPERTY_TYPE_UINT32); + MockProperty DeviceLibReqMask("", Data, PI_PROPERTY_TYPE_UINT32); insert(__SYCL_PI_PROPERTY_SET_DEVICELIB_REQ_MASK, - PiArray{DeviceLibReqMask}); + Array{DeviceLibReqMask}); } /// Adds a new array of properties to the set. /// /// \param Name is a property array name. See pi.h for list of known names. /// \param Props is an array of property values. - void insert(const std::string &Name, PiArray Props) { + void insert(const std::string &Name, Array Props) { MNames.push_back(Name); MMockProperties.push_back(std::move(Props)); MProperties.push_back(_pi_device_binary_property_set_struct{ @@ -214,20 +215,20 @@ class PiPropertySet { private: std::vector MNames; - std::vector> MMockProperties; + std::vector> MMockProperties; std::vector<_pi_device_binary_property_set_struct> MProperties; }; /// Convenience wrapper around PI internal structures, that manages PI binary /// image data lifecycle. -class PiImage { +class MockDeviceImage { public: /// Constructs an arbitrary device image. - PiImage(uint16_t Version, uint8_t Kind, uint8_t Format, + 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, - PiArray OffloadEntries, PiPropertySet PropertySet) + Array OffloadEntries, MockPropertySet PropertySet) : MVersion(Version), MKind(Kind), MFormat(Format), MDeviceTargetSpec(DeviceTargetSpec), MCompileOptions(CompileOptions), MLinkOptions(LinkOptions), MManifest(std::move(Manifest)), @@ -235,14 +236,17 @@ class PiImage { MPropertySet(std::move(PropertySet)) {} /// Constructs a SYCL device image of the latest version. - PiImage(uint8_t Format, const std::string &DeviceTargetSpec, - const std::string &CompileOptions, const std::string &LinkOptions, - std::vector Binary, - PiArray OffloadEntries, PiPropertySet PropertySet) - : PiImage(PI_DEVICE_BINARY_VERSION, PI_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, + Array OffloadEntries, + MockPropertySet PropertySet) + : MockDeviceImage(PI_DEVICE_BINARY_VERSION, + PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL, Format, + DeviceTargetSpec, CompileOptions, LinkOptions, {}, + std::move(Binary), std::move(OffloadEntries), + std::move(PropertySet)) {} pi_device_binary_struct convertToNativeType() { return pi_device_binary_struct{ @@ -273,8 +277,8 @@ class PiImage { std::string MLinkOptions; std::vector MManifest; std::vector MBinary; - PiArray MOffloadEntries; - PiPropertySet MPropertySet; + Array MOffloadEntries; + MockPropertySet MPropertySet; }; /// Convenience wrapper around pi_device_binaries_struct, that manages mock @@ -283,7 +287,7 @@ template class PiImageArray { public: static constexpr size_t NumberOfImages = __NumberOfImages; - PiImageArray(PiImage *Imgs) { + PiImageArray(MockDeviceImage *Imgs) { for (size_t Idx = 0; Idx < NumberOfImages; ++Idx) MNativeImages[Idx] = Imgs[Idx].convertToNativeType(); @@ -330,7 +334,7 @@ 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 PiProperty makeSpecConstant(std::vector &ValData, +inline MockProperty makeSpecConstant(std::vector &ValData, const std::string &Name, std::initializer_list IDs, std::initializer_list Offsets, @@ -382,15 +386,15 @@ inline PiProperty makeSpecConstant(std::vector &ValData, iterate_tuple(FillData, DefaultValues); - PiProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } /// Utility function to mark kernel as the one using assert inline void setKernelUsesAssert(const std::vector &Names, - PiPropertySet &Set) { - PiArray Value; + MockPropertySet &Set) { + Array Value; for (const std::string &N : Names) Value.push_back({N, {0, 0, 0, 0}, PI_PROPERTY_TYPE_UINT32}); Set.insert(__SYCL_PI_PROPERTY_SET_SYCL_ASSERT_USED, std::move(Value)); @@ -399,36 +403,37 @@ 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(PiArray SpecConstants, - std::vector ValData, PiPropertySet &Props) { +inline void addSpecConstants(Array SpecConstants, + std::vector ValData, + MockPropertySet &Props) { Props.insert(__SYCL_PI_PROPERTY_SET_SPEC_CONST_MAP, std::move(SpecConstants)); - PiProperty Prop{"all", std::move(ValData), PI_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{"all", std::move(ValData), PI_PROPERTY_TYPE_BYTE_ARRAY}; - PiArray DefaultValues{std::move(Prop)}; + Array DefaultValues{std::move(Prop)}; Props.insert(__SYCL_PI_PROPERTY_SET_SPEC_CONST_DEFAULT_VALUES_MAP, std::move(DefaultValues)); } /// Utility function to add ESIMD kernel flag to property set. -inline void addESIMDFlag(PiPropertySet &Props) { +inline void addESIMDFlag(MockPropertySet &Props) { std::vector ValData(sizeof(uint32_t)); ValData[0] = 1; - PiProperty Prop{"isEsimdImage", ValData, PI_PROPERTY_TYPE_UINT32}; + MockProperty Prop{"isEsimdImage", ValData, PI_PROPERTY_TYPE_UINT32}; - PiArray Value{std::move(Prop)}; + Array Value{std::move(Prop)}; Props.insert(__SYCL_PI_PROPERTY_SET_SYCL_MISC_PROP, std::move(Value)); } /// Utility function to generate offload entries for kernels without arguments. -inline PiArray +inline Array makeEmptyKernels(std::initializer_list KernelNames) { - PiArray Entries; + Array Entries; for (const auto &Name : KernelNames) { - PiOffloadEntry E{Name, {}, 0}; + MockOffloadEntry E{Name, {}, 0}; Entries.push_back(std::move(E)); } return Entries; @@ -439,7 +444,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 PiProperty +inline MockProperty makeKernelParamOptInfo(const std::string &Name, const size_t NumArgs, const std::vector &ElimArgMask) { const size_t BYTES_FOR_SIZE = 8; @@ -451,7 +456,7 @@ makeKernelParamOptInfo(const std::string &Name, const size_t NumArgs, std::uninitialized_copy(ElimArgMask.begin(), ElimArgMask.end(), DescData.data() + BYTES_FOR_SIZE); - PiProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } @@ -462,7 +467,7 @@ 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 PiProperty makeDeviceGlobalInfo(const std::string &Name, +inline MockProperty makeDeviceGlobalInfo(const std::string &Name, const uint32_t TypeSize, const std::uint32_t DeviceImageScoped) { constexpr size_t BYTES_FOR_SIZE = 8; @@ -474,7 +479,7 @@ inline PiProperty makeDeviceGlobalInfo(const std::string &Name, std::memcpy(DescData.data() + BYTES_FOR_SIZE + sizeof(TypeSize), &DeviceImageScoped, sizeof(DeviceImageScoped)); - PiProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } @@ -484,7 +489,7 @@ inline PiProperty 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 PiProperty makeHostPipeInfo(const std::string &Name, +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); @@ -493,13 +498,13 @@ inline PiProperty makeHostPipeInfo(const std::string &Name, std::memcpy(DescData.data(), &BytesForArgs, sizeof(BytesForArgs)); std::memcpy(DescData.data() + BYTES_FOR_SIZE, &TypeSize, sizeof(TypeSize)); - PiProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; + MockProperty Prop{Name, DescData, PI_PROPERTY_TYPE_BYTE_ARRAY}; return Prop; } /// Utility function to add aspects to property set. -inline PiProperty 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)); @@ -512,7 +517,7 @@ inline PiProperty makeAspectsProp(const std::vector &Aspects) { return {"aspects", ValData, PI_PROPERTY_TYPE_BYTE_ARRAY}; } -inline PiProperty 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(); @@ -526,25 +531,25 @@ inline PiProperty makeReqdWGSizeProp(const std::vector &ReqdWGSize) { } inline void -addDeviceRequirementsProps(PiPropertySet &Props, +addDeviceRequirementsProps(MockPropertySet &Props, const std::vector &Aspects, const std::vector &ReqdWGSize = {}) { - PiArray Value{makeAspectsProp(Aspects)}; + Array Value{makeAspectsProp(Aspects)}; if (!ReqdWGSize.empty()) Value.push_back(makeReqdWGSizeProp(ReqdWGSize)); Props.insert(__SYCL_PI_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS, std::move(Value)); } -inline PiImage +inline MockDeviceImage generateDefaultImage(std::initializer_list KernelNames) { - PiPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels(KernelNames); + Array Entries = makeEmptyKernels(KernelNames); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format + MockDeviceImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec "", // Compile options "", // Link options diff --git a/sycl/unittests/helpers/TestKernel.hpp b/sycl/unittests/helpers/TestKernel.hpp index 0edc129e03413..12d336e3b2b04 100644 --- a/sycl/unittests/helpers/TestKernel.hpp +++ b/sycl/unittests/helpers/TestKernel.hpp @@ -9,7 +9,7 @@ #pragma once #include "MockKernelInfo.hpp" -#include "PiImage.hpp" +#include "MockDeviceImage.hpp" template class TestKernel; @@ -33,6 +33,6 @@ struct KernelInfo> } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage Img = +static sycl::unittest::MockDeviceImage Img = sycl::unittest::generateDefaultImage({"TestKernel"}); static sycl::unittest::PiImageArray<1> ImgArray{&Img}; diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index 3b4089d50deb2..b4ec4ee3a63c3 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/pi.h" #include -#include +#include #include #include @@ -50,32 +50,34 @@ template <> const char *get_spec_constant_symbolic_ID() { } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; std::vector SpecConstData; - PiProperty SC1 = makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); + MockProperty SC1 = + makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); - PiPropertySet PropSet; + MockPropertySet PropSet; addSpecConstants({SC1}, std::move(SpecConstData), PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = + Array Entries = makeEmptyKernels({"CacheTestKernel", "CacheTestKernel2"}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage Img = generateDefaultImage(); +static sycl::unittest::MockDeviceImage Img = generateDefaultImage(); static sycl::unittest::PiImageArray<1> ImgArray{&Img}; struct TestCtx { diff --git a/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp b/sycl/unittests/kernel-and-program/KernelBuildOptions.cpp index 49f1a4c10f2de..152da1b87dda7 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 @@ -78,27 +78,28 @@ static void setupCommonMockAPIs(sycl::unittest::PiMock &Mock) { Mock.redefineBefore(redefinedProgramBuild); } -static sycl::unittest::PiImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; - PiPropertySet PropSet; + MockPropertySet PropSet; addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels({"BuildOptsTestKernel"}); + Array Entries = makeEmptyKernels({"BuildOptsTestKernel"}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "-compile-img", // Compile options - "-link-img", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_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::PiImage Img = generateDefaultImage(); +sycl::unittest::MockDeviceImage Img = generateDefaultImage(); sycl::unittest::PiImageArray<1> ImgArray{&Img}; TEST(KernelBuildOptions, KernelBundleBasic) { diff --git a/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp b/sycl/unittests/kernel-and-program/MultipleDevsCache.cpp index 77744401efdd4..d811f53eeaacd 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 @@ -25,7 +25,7 @@ class MultipleDevsCacheTestKernel; MOCK_INTEGRATION_HEADER(MultipleDevsCacheTestKernel) -static sycl::unittest::PiImage Img = +static sycl::unittest::MockDeviceImage Img = sycl::unittest::generateDefaultImage({"MultipleDevsCacheTestKernel"}); static sycl::unittest::PiImageArray<1> ImgArray{&Img}; diff --git a/sycl/unittests/kernel-and-program/OutOfResources.cpp b/sycl/unittests/kernel-and-program/OutOfResources.cpp index b839618264901..cb3a3c48c1970 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 @@ -27,7 +27,7 @@ class OutOfResourcesKernel2; MOCK_INTEGRATION_HEADER(OutOfResourcesKernel1) MOCK_INTEGRATION_HEADER(OutOfResourcesKernel2) -static sycl::unittest::PiImage Img[2] = { +static sycl::unittest::MockDeviceImage Img[2] = { sycl::unittest::generateDefaultImage({"OutOfResourcesKernel1"}), sycl::unittest::generateDefaultImage({"OutOfResourcesKernel2"})}; diff --git a/sycl/unittests/pipes/host_pipe_registration.cpp b/sycl/unittests/pipes/host_pipe_registration.cpp index 4938c4a89ae1a..389c1670f18a2 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 @@ -29,29 +29,30 @@ class PipeID; using Pipe = sycl::ext::intel::experimental::pipe; -static sycl::unittest::PiImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; sycl::detail::host_pipe_map::add(Pipe::get_host_ptr(), "test_host_pipe_unique_id"); - PiPropertySet PropSet; - PiProperty HostPipeInfo = + MockPropertySet PropSet; + MockProperty HostPipeInfo = makeHostPipeInfo("test_host_pipe_unique_id", sizeof(int)); PropSet.insert(__SYCL_PI_PROPERTY_SET_SYCL_HOST_PIPES, - PiArray{std::move(HostPipeInfo)}); + Array{std::move(HostPipeInfo)}); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels({"TestKernel"}); + Array Entries = makeEmptyKernels({"TestKernel"}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } @@ -126,7 +127,7 @@ class PipeTest : public ::testing::Test { queue q; }; -static sycl::unittest::PiImage Img = generateDefaultImage(); +static sycl::unittest::MockDeviceImage Img = generateDefaultImage(); static sycl::unittest::PiImageArray<1> ImgArray{&Img}; TEST_F(PipeTest, Basic) { diff --git a/sycl/unittests/program_manager/BuildLog.cpp b/sycl/unittests/program_manager/BuildLog.cpp index a1829d4c06e4d..0663c0548e43a 100644 --- a/sycl/unittests/program_manager/BuildLog.cpp +++ b/sycl/unittests/program_manager/BuildLog.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sycl/unittests/program_manager/DynamicLinking.cpp b/sycl/unittests/program_manager/DynamicLinking.cpp index 0febee4e10fab..d88a3a60e8316 100644 --- a/sycl/unittests/program_manager/DynamicLinking.cpp +++ b/sycl/unittests/program_manager/DynamicLinking.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include @@ -37,31 +37,31 @@ KERNEL_INFO(AOTCaseKernel) } // namespace sycl namespace { -sycl::unittest::PiArray +sycl::unittest::Array createPropertySet(const std::vector &Symbols) { - sycl::unittest::PiPropertySet PropSet; - sycl::unittest::PiArray Props; + sycl::unittest::MockPropertySet PropSet; + sycl::unittest::Array Props; for (const std::string &Symbol : Symbols) { std::vector Storage(sizeof(pi_uint32)); uint32_t Val = 1; auto *DataPtr = reinterpret_cast(&Val); std::uninitialized_copy(DataPtr, DataPtr + sizeof(uint32_t), Storage.data()); - sycl::unittest::PiProperty Prop(Symbol, Storage, PI_PROPERTY_TYPE_UINT32); + sycl::unittest::MockProperty Prop(Symbol, Storage, PI_PROPERTY_TYPE_UINT32); Props.push_back(Prop); } return Props; } -sycl::unittest::PiImage +sycl::unittest::MockDeviceImage generateImage(std::initializer_list KernelNames, const std::vector &ExportedSymbols, const std::vector &ImportedSymbols, unsigned char Magic, sycl::detail::pi::PiDeviceBinaryType BinType = PI_DEVICE_BINARY_TYPE_SPIRV) { - sycl::unittest::PiPropertySet PropSet; + sycl::unittest::MockPropertySet PropSet; if (!ExportedSymbols.empty()) PropSet.insert(__SYCL_PI_PROPERTY_SET_SYCL_EXPORTED_SYMBOLS, createPropertySet(ExportedSymbols)); @@ -70,10 +70,10 @@ generateImage(std::initializer_list KernelNames, createPropertySet(ImportedSymbols)); std::vector Bin{Magic}; - sycl::unittest::PiArray Entries = + sycl::unittest::Array Entries = sycl::unittest::makeEmptyKernels(KernelNames); - sycl::unittest::PiImage Img{ + sycl::unittest::MockDeviceImage Img{ BinType, __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec "", // Compile options @@ -95,7 +95,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::PiImage Imgs[] = { +static sycl::unittest::MockDeviceImage Imgs[] = { generateImage({"BasicCaseKernel"}, {}, {"BasicCaseKernelDep"}, BASIC_CASE_PRG), generateImage({"BasicCaseKernelDep"}, {"BasicCaseKernelDep"}, diff --git a/sycl/unittests/program_manager/SubDevices.cpp b/sycl/unittests/program_manager/SubDevices.cpp index 39f82a48dc271..31c1a8aecb327 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 fbbf3b7256437..6a470e5a210ed 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 @@ -43,56 +43,58 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage generateEAMTestKernelImage() { +static sycl::unittest::MockDeviceImage generateEAMTestKernelImage() { using namespace sycl::unittest; // Eliminated arguments are 1st and 3rd. std::vector KernelEAM{0b00000101}; - PiProperty EAMKernelPOI = makeKernelParamOptInfo( + MockProperty EAMKernelPOI = makeKernelParamOptInfo( EAMTestKernelName, EAMTestKernelNumArgs, KernelEAM); - PiArray ImgKPOI{std::move(EAMKernelPOI)}; + Array ImgKPOI{std::move(EAMKernelPOI)}; - PiPropertySet PropSet; + MockPropertySet PropSet; PropSet.insert(__SYCL_PI_PROPERTY_SET_KERNEL_PARAM_OPT_INFO, std::move(ImgKPOI)); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = makeEmptyKernels({EAMTestKernelName}); + Array Entries = makeEmptyKernels({EAMTestKernelName}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage generateEAMTestKernel2Image() { +static sycl::unittest::MockDeviceImage generateEAMTestKernel2Image() { using namespace sycl::unittest; - PiPropertySet PropSet; + MockPropertySet PropSet; std::vector Bin{6, 7, 8, 9, 10, 11}; // Random data - PiArray Entries = makeEmptyKernels({EAMTestKernel2Name}); + Array Entries = makeEmptyKernels({EAMTestKernel2Name}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -static sycl::unittest::PiImage EAMImg = generateEAMTestKernelImage(); -static sycl::unittest::PiImage EAM2Img = generateEAMTestKernel2Image(); +static sycl::unittest::MockDeviceImage EAMImg = generateEAMTestKernelImage(); +static sycl::unittest::MockDeviceImage EAM2Img = generateEAMTestKernel2Image(); static sycl::unittest::PiImageArray<1> EAMImgArray{&EAMImg}; static sycl::unittest::PiImageArray<1> EAM2ImgArray{&EAM2Img}; diff --git a/sycl/unittests/program_manager/itt_annotations.cpp b/sycl/unittests/program_manager/itt_annotations.cpp index 444b2aaacdaf6..ebba9b2ea47b7 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 90669004d4625..c77d422ca8bf1 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 @@ -56,32 +56,33 @@ struct KernelInfo : public unittest::MockKernelInfoBase { } // namespace sycl template -static sycl::unittest::PiImage +static sycl::unittest::MockDeviceImage generateEAMTestKernelImage(std::string _cmplOptions, std::string _lnkOptions) { using namespace sycl::unittest; std::vector KernelEAM1{0b00000101}; - PiProperty EAMKernelPOI = + MockProperty EAMKernelPOI = makeKernelParamOptInfo(sycl::detail::KernelInfo::getName(), EAMTestKernelNumArgs1, KernelEAM1); - PiArray ImgKPOI{std::move(EAMKernelPOI)}; + Array ImgKPOI{std::move(EAMKernelPOI)}; - PiPropertySet PropSet; + MockPropertySet PropSet; PropSet.insert(__SYCL_PI_PROPERTY_SET_KERNEL_PARAM_OPT_INFO, std::move(ImgKPOI)); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = + Array Entries = makeEmptyKernels({sycl::detail::KernelInfo::getName()}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - _cmplOptions, // Compile options - _lnkOptions, // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + _cmplOptions, // Compile options + _lnkOptions, // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } @@ -134,7 +135,7 @@ 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::PiImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = generateEAMTestKernelImage(expected_options, expected_options); static sycl::unittest::PiImageArray<1> DevImageArray_{&DevImage}; @@ -164,7 +165,7 @@ 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::PiImage DevImage_1 = + static sycl::unittest::MockDeviceImage DevImage_1 = generateEAMTestKernelImage(expected_compile_options_1, expected_link_options_1); @@ -199,7 +200,7 @@ 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::PiImage DevImage = + static sycl::unittest::MockDeviceImage DevImage = generateEAMTestKernelImage(expected_compile_options, expected_link_options); static sycl::unittest::PiImageArray<1> DevImageArray{&DevImage}; diff --git a/sycl/unittests/queue/GetProfilingInfo.cpp b/sycl/unittests/queue/GetProfilingInfo.cpp index 13f49b5bafa4d..774a2c830d606 100644 --- a/sycl/unittests/queue/GetProfilingInfo.cpp +++ b/sycl/unittests/queue/GetProfilingInfo.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp index daf8599947ad2..bd00da34cf870 100644 --- a/sycl/unittests/scheduler/CommandsWaitForEvents.cpp +++ b/sycl/unittests/scheduler/CommandsWaitForEvents.cpp @@ -9,7 +9,7 @@ #include "SchedulerTest.hpp" #include "SchedulerTestUtils.hpp" #include -#include +#include #include #include @@ -100,28 +100,29 @@ struct KernelInfo } // namespace _V1 } // namespace sycl -static sycl::unittest::PiImage generateDefaultImage() { +static sycl::unittest::MockDeviceImage generateDefaultImage() { using namespace sycl::unittest; - PiPropertySet PropSet; + MockPropertySet PropSet; addESIMDFlag(PropSet); std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - PiArray Entries = + Array Entries = makeEmptyKernels({"StreamAUXCmdsWait_TestKernel"}); - PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; + MockDeviceImage Img{ + PI_DEVICE_BINARY_TYPE_SPIRV, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; return Img; } -sycl::unittest::PiImage Img = generateDefaultImage(); +sycl::unittest::MockDeviceImage Img = generateDefaultImage(); sycl::unittest::PiImageArray<1> ImgArray{&Img}; class EventImplProxyT : public sycl::detail::event_impl { diff --git a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp index 58b28237a4958..577a7e3d395c6 100644 --- a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp +++ b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp @@ -9,7 +9,7 @@ #include "SchedulerTest.hpp" #include "SchedulerTestUtils.hpp" -#include +#include #include #include diff --git a/sycl/unittests/scheduler/RequiredWGSize.cpp b/sycl/unittests/scheduler/RequiredWGSize.cpp index 29b9f8fc2b8ac..4b87aeb41338b 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 c25e744801f6d..19ebc545c73b8 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 5a2ebc5e6a421..6ea6390c4deca 100644 --- a/sycl/unittests/windows/dllmain.cpp +++ b/sycl/unittests/windows/dllmain.cpp @@ -12,7 +12,7 @@ * distinct binary executable. */ -#include +#include #include #include