Skip to content

Commit eded703

Browse files
[SYCL][NFC] Detach unit-tests naming from UR (#14815)
This is a follow-up from #14145. Our unit tests have mock classes corresponding to device images and other entries our compiler generates. They are all named using `Ur` prefix, but they have nothing to do with Unified Runtime, they are part of our compiler interface. This patch renames associated files and classes so they do not refer to `Ur` anymore. This is a mechanical find-and-replace change.
1 parent 4a274fc commit eded703

24 files changed

+337
-322
lines changed

sycl/unittests/Extensions/DeviceGlobal.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include "detail/context_impl.hpp"
1212
#include "detail/kernel_program_cache.hpp"
1313

14+
#include <helpers/MockDeviceImage.hpp>
1415
#include <helpers/MockKernelInfo.hpp>
15-
#include <helpers/UrImage.hpp>
1616
#include <helpers/UrMock.hpp>
1717

1818
#include <gtest/gtest.h>
@@ -53,29 +53,29 @@ struct KernelInfo<DeviceGlobalImgScopeTestKernel>
5353
} // namespace _V1
5454
} // namespace sycl
5555

56-
static sycl::unittest::UrImage generateDeviceGlobalImage() {
56+
static sycl::unittest::MockDeviceImage generateDeviceGlobalImage() {
5757
using namespace sycl::unittest;
5858

5959
// Call device global map initializer explicitly to mimic the integration
6060
// header.
6161
sycl::detail::device_global_map::add(&DeviceGlobal, DeviceGlobalName);
6262

6363
// Insert remaining device global info into the binary.
64-
UrPropertySet PropSet;
65-
UrProperty DevGlobInfo =
64+
MockPropertySet PropSet;
65+
MockProperty DevGlobInfo =
6666
makeDeviceGlobalInfo(DeviceGlobalName, sizeof(int) * 2, 0);
6767
PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS,
68-
std::vector<UrProperty>{std::move(DevGlobInfo)});
68+
std::vector<MockProperty>{std::move(DevGlobInfo)});
6969

70-
std::vector<UrOffloadEntry> Entries =
70+
std::vector<MockOffloadEntry> Entries =
7171
makeEmptyKernels({DeviceGlobalTestKernelName});
7272

73-
UrImage Img(std::move(Entries), std::move(PropSet));
73+
MockDeviceImage Img(std::move(Entries), std::move(PropSet));
7474

7575
return Img;
7676
}
7777

78-
static sycl::unittest::UrImage generateDeviceGlobalImgScopeImage() {
78+
static sycl::unittest::MockDeviceImage generateDeviceGlobalImgScopeImage() {
7979
using namespace sycl::unittest;
8080

8181
// Call device global map initializer explicitly to mimic the integration
@@ -84,24 +84,24 @@ static sycl::unittest::UrImage generateDeviceGlobalImgScopeImage() {
8484
DeviceGlobalImgScopeName);
8585

8686
// Insert remaining device global info into the binary.
87-
UrPropertySet PropSet;
88-
UrProperty DevGlobInfo =
87+
MockPropertySet PropSet;
88+
MockProperty DevGlobInfo =
8989
makeDeviceGlobalInfo(DeviceGlobalImgScopeName, sizeof(int) * 2, 1);
9090
PropSet.insert(__SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS,
91-
std::vector<UrProperty>{std::move(DevGlobInfo)});
91+
std::vector<MockProperty>{std::move(DevGlobInfo)});
9292

93-
std::vector<UrOffloadEntry> Entries =
93+
std::vector<MockOffloadEntry> Entries =
9494
makeEmptyKernels({DeviceGlobalImgScopeTestKernelName});
9595

96-
UrImage Img(std::move(Entries), std::move(PropSet));
96+
MockDeviceImage Img(std::move(Entries), std::move(PropSet));
9797

9898
return Img;
9999
}
100100

101101
namespace {
102-
sycl::unittest::UrImage Imgs[] = {generateDeviceGlobalImage(),
103-
generateDeviceGlobalImgScopeImage()};
104-
sycl::unittest::UrImageArray<2> ImgArray{Imgs};
102+
sycl::unittest::MockDeviceImage Imgs[] = {generateDeviceGlobalImage(),
103+
generateDeviceGlobalImgScopeImage()};
104+
sycl::unittest::MockDeviceImageArray<2> ImgArray{Imgs};
105105

106106
// Trackers.
107107
thread_local DeviceGlobalElemType MockDeviceGlobalMem;

sycl/unittests/Extensions/USMMemcpy2D.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
#include <detail/queue_impl.hpp>
1212

13+
#include <helpers/MockDeviceImage.hpp>
1314
#include <helpers/MockKernelInfo.hpp>
14-
#include <helpers/UrImage.hpp>
1515
#include <helpers/UrMock.hpp>
1616

1717
#include <gtest/gtest.h>
@@ -126,10 +126,10 @@ struct KernelInfo<class __usmmemcpy2d<unsigned char>>
126126
} // namespace sycl
127127

128128
namespace {
129-
sycl::unittest::UrImage Imgs[] = {sycl::unittest::generateDefaultImage(
129+
sycl::unittest::MockDeviceImage Imgs[] = {sycl::unittest::generateDefaultImage(
130130
{USMFillHelperKernelNameLong, USMFillHelperKernelNameChar,
131131
USMMemcpyHelperKernelNameLong, USMMemcpyHelperKernelNameChar})};
132-
sycl::unittest::UrImageArray<1> ImgArray{Imgs};
132+
sycl::unittest::MockDeviceImageArray<1> ImgArray{Imgs};
133133

134134
ur_context_info_t LastMemopsQuery = UR_CONTEXT_INFO_NUM_DEVICES;
135135

sycl/unittests/Extensions/VirtualFunctions/RuntimeLinking.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include "ur_mock_helpers.hpp"
33
#include <sycl/sycl.hpp>
44

5+
#include <helpers/MockDeviceImage.hpp>
56
#include <helpers/MockKernelInfo.hpp>
67
#include <helpers/RuntimeLinkingCommon.hpp>
7-
#include <helpers/UrImage.hpp>
88
#include <helpers/UrMock.hpp>
99

1010
#include <gtest/gtest.h>
@@ -46,11 +46,11 @@ KERNEL_INFO(KernelG)
4646
} // namespace _V1
4747
} // namespace sycl
4848

49-
static sycl::unittest::UrImage
49+
static sycl::unittest::MockDeviceImage
5050
generateImage(std::initializer_list<std::string> KernelNames,
5151
const std::string &VFSets, bool UsesVFSets, unsigned char Magic) {
52-
sycl::unittest::UrPropertySet PropSet;
53-
std::vector<sycl::unittest::UrProperty> Props;
52+
sycl::unittest::MockPropertySet PropSet;
53+
std::vector<sycl::unittest::MockProperty> Props;
5454
uint64_t PropSize = VFSets.size();
5555
std::vector<char> Storage(/* bytes for size */ 8 + PropSize +
5656
/* null terminator */ 1);
@@ -61,18 +61,18 @@ generateImage(std::initializer_list<std::string> KernelNames,
6161
Storage.back() = '\0';
6262
const std::string PropName =
6363
UsesVFSets ? "uses-virtual-functions-set" : "virtual-functions-set";
64-
sycl::unittest::UrProperty Prop(PropName, Storage,
65-
SYCL_PROPERTY_TYPE_BYTE_ARRAY);
64+
sycl::unittest::MockProperty Prop(PropName, Storage,
65+
SYCL_PROPERTY_TYPE_BYTE_ARRAY);
6666

6767
Props.push_back(Prop);
6868
PropSet.insert(__SYCL_PROPERTY_SET_SYCL_VIRTUAL_FUNCTIONS, std::move(Props));
6969

7070
std::vector<unsigned char> Bin{Magic};
7171

72-
std::vector<sycl::unittest::UrOffloadEntry> Entries =
72+
std::vector<sycl::unittest::MockOffloadEntry> Entries =
7373
sycl::unittest::makeEmptyKernels(KernelNames);
7474

75-
sycl::unittest::UrImage Img{
75+
sycl::unittest::MockDeviceImage Img{
7676
SYCL_DEVICE_BINARY_TYPE_SPIRV, // Format
7777
__SYCL_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec
7878
"", // Compile options
@@ -103,7 +103,7 @@ static constexpr unsigned PROGRAM_F1 = 53;
103103
// Device images with no entires are ignored by SYCL RT during registration.
104104
// Therefore, we have to provide some kernel names to make the test work, even
105105
// if we don't really have them/use them.
106-
static sycl::unittest::UrImage Imgs[] = {
106+
static sycl::unittest::MockDeviceImage Imgs[] = {
107107
generateImage({"KernelA"}, "set-a", /* uses vf set */ true, PROGRAM_A),
108108
generateImage({"DummyKernel0"}, "set-a", /* provides vf set */ false,
109109
PROGRAM_A0),
@@ -131,7 +131,7 @@ static sycl::unittest::UrImage Imgs[] = {
131131
generateImage({"KernelG"}, "set-f", /* uses vf set */ true, PROGRAM_F1)};
132132

133133
// Registers mock devices images in the SYCL RT
134-
static sycl::unittest::UrImageArray<15> ImgArray{Imgs};
134+
static sycl::unittest::MockDeviceImageArray<15> ImgArray{Imgs};
135135

136136
TEST(VirtualFunctions, SingleKernelUsesSingleVFSet) {
137137
sycl::unittest::UrMock<> Mock;

sycl/unittests/Extensions/WorkGroupMemoryBackendArgument.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <gtest/gtest.h>
10-
#include <helpers/UrImage.hpp>
10+
#include <helpers/MockDeviceImage.hpp>
1111
#include <helpers/UrMock.hpp>
1212
#include <sycl/sycl.hpp>
1313

@@ -38,9 +38,9 @@ template <> struct KernelInfo<WorkGroupMemoryKernel> {
3838
} // namespace _V1
3939
} // namespace sycl
4040

41-
static sycl::unittest::UrImage Img =
41+
static sycl::unittest::MockDeviceImage Img =
4242
sycl::unittest::generateDefaultImage({"WorkGroupMemoryKernel"});
43-
static sycl::unittest::UrImageArray<1> ImgArray{&Img};
43+
static sycl::unittest::MockDeviceImageArray<1> ImgArray{&Img};
4444

4545
static int urKernelSetArgLocalCalls = 0;
4646
inline ur_result_t redefined_urKernelSetArgLocal(void *) {

sycl/unittests/SYCL2020/IsCompatible.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <sycl/sycl.hpp>
22

3+
#include <helpers/MockDeviceImage.hpp>
34
#include <helpers/MockKernelInfo.hpp>
4-
#include <helpers/UrImage.hpp>
55
#include <helpers/UrMock.hpp>
66

77
#include <gtest/gtest.h>
@@ -22,22 +22,22 @@ MOCK_INTEGRATION_HEADER(TestKernelCPUValidReqdWGSize3D)
2222
MOCK_INTEGRATION_HEADER(TestKernelGPU)
2323
MOCK_INTEGRATION_HEADER(TestKernelACC)
2424

25-
static sycl::unittest::UrImage
25+
static sycl::unittest::MockDeviceImage
2626
generateDefaultImage(std::initializer_list<std::string> KernelNames,
2727
const std::vector<sycl::aspect> &Aspects,
2828
const std::vector<int> &ReqdWGSize = {}) {
2929
using namespace sycl::unittest;
3030

31-
UrPropertySet PropSet;
31+
MockPropertySet PropSet;
3232
addDeviceRequirementsProps(PropSet, Aspects, ReqdWGSize);
33-
std::vector<UrOffloadEntry> Entries = makeEmptyKernels(KernelNames);
33+
std::vector<MockOffloadEntry> Entries = makeEmptyKernels(KernelNames);
3434

35-
UrImage Img(std::move(Entries), std::move(PropSet));
35+
MockDeviceImage Img(std::move(Entries), std::move(PropSet));
3636

3737
return Img;
3838
}
3939

40-
static sycl::unittest::UrImage Imgs[7] = {
40+
static sycl::unittest::MockDeviceImage Imgs[7] = {
4141
// Images for validating checks based on max_work_group_size + aspects
4242
generateDefaultImage({"TestKernelCPU"}, {sycl::aspect::cpu},
4343
{32}), // 32 <= 256 (OK)
@@ -56,7 +56,7 @@ static sycl::unittest::UrImage Imgs[7] = {
5656
generateDefaultImage({"TestKernelGPU"}, {sycl::aspect::gpu}),
5757
generateDefaultImage({"TestKernelACC"}, {sycl::aspect::accelerator})};
5858

59-
static sycl::unittest::UrImageArray<7> ImgArray{Imgs};
59+
static sycl::unittest::MockDeviceImageArray<7> ImgArray{Imgs};
6060

6161
static ur_result_t redefinedDeviceGetInfoCPU(void *pParams) {
6262
auto params = *static_cast<ur_device_get_info_params_t *>(pParams);

sycl/unittests/SYCL2020/KernelBundle.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include <detail/kernel_bundle_impl.hpp>
1111
#include <sycl/sycl.hpp>
1212

13+
#include <helpers/MockDeviceImage.hpp>
1314
#include <helpers/MockKernelInfo.hpp>
14-
#include <helpers/UrImage.hpp>
1515
#include <helpers/UrMock.hpp>
1616

1717
#include <gtest/gtest.h>
@@ -24,33 +24,33 @@ MOCK_INTEGRATION_HEADER(TestKernel)
2424
MOCK_INTEGRATION_HEADER(TestKernelExeOnly)
2525
MOCK_INTEGRATION_HEADER(TestKernelWithAspects)
2626

27-
static sycl::unittest::UrImage
27+
static sycl::unittest::MockDeviceImage
2828
generateDefaultImage(std::initializer_list<std::string> KernelNames,
2929
sycl_device_binary_type BinaryType,
3030
const char *DeviceTargetSpec,
3131
const std::vector<sycl::aspect> &Aspects = {}) {
3232
using namespace sycl::unittest;
3333

34-
UrPropertySet PropSet;
34+
MockPropertySet PropSet;
3535
if (!Aspects.empty())
3636
addDeviceRequirementsProps(PropSet, Aspects);
3737

3838
std::vector<unsigned char> Bin{0, 1, 2, 3, 4, 5}; // Random data
3939

40-
std::vector<UrOffloadEntry> Entries = makeEmptyKernels(KernelNames);
40+
std::vector<MockOffloadEntry> Entries = makeEmptyKernels(KernelNames);
4141

42-
UrImage Img{BinaryType, // Format
43-
DeviceTargetSpec,
44-
"", // Compile options
45-
"", // Link options
46-
std::move(Bin),
47-
std::move(Entries),
48-
std::move(PropSet)};
42+
MockDeviceImage Img{BinaryType, // Format
43+
DeviceTargetSpec,
44+
"", // Compile options
45+
"", // Link options
46+
std::move(Bin),
47+
std::move(Entries),
48+
std::move(PropSet)};
4949

5050
return Img;
5151
}
5252

53-
static sycl::unittest::UrImage Imgs[] = {
53+
static sycl::unittest::MockDeviceImage Imgs[] = {
5454
generateDefaultImage({"TestKernel"}, SYCL_DEVICE_BINARY_TYPE_SPIRV,
5555
__SYCL_DEVICE_BINARY_TARGET_SPIRV64),
5656
generateDefaultImage({"TestKernelExeOnly"}, SYCL_DEVICE_BINARY_TYPE_NATIVE,
@@ -61,7 +61,7 @@ static sycl::unittest::UrImage Imgs[] = {
6161
generateDefaultImage(
6262
{"TestKernelWithAspects"}, SYCL_DEVICE_BINARY_TYPE_NATIVE,
6363
__SYCL_DEVICE_BINARY_TARGET_SPIRV64, {sycl::aspect::gpu})};
64-
static sycl::unittest::UrImageArray<std::size(Imgs)> ImgArray{Imgs};
64+
static sycl::unittest::MockDeviceImageArray<std::size(Imgs)> ImgArray{Imgs};
6565

6666
static ur_result_t redefinedDeviceGetInfoCPU(void *pParams) {
6767
auto params = *static_cast<ur_device_get_info_params_t *>(pParams);

sycl/unittests/SYCL2020/KernelBundleStateFiltering.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include <detail/kernel_bundle_impl.hpp>
1111
#include <sycl/sycl.hpp>
1212

13+
#include <helpers/MockDeviceImage.hpp>
1314
#include <helpers/MockKernelInfo.hpp>
14-
#include <helpers/UrImage.hpp>
1515
#include <helpers/UrMock.hpp>
1616

1717
#include <gtest/gtest.h>
@@ -35,26 +35,26 @@ MOCK_INTEGRATION_HEADER(KernelE)
3535
namespace {
3636

3737
std::set<const void *> TrackedImages;
38-
sycl::unittest::UrImage
38+
sycl::unittest::MockDeviceImage
3939
generateDefaultImage(std::initializer_list<std::string> KernelNames,
4040
sycl_device_binary_type BinaryType,
4141
const char *DeviceTargetSpec) {
4242
using namespace sycl::unittest;
4343

44-
UrPropertySet PropSet;
44+
MockPropertySet PropSet;
4545

4646
static unsigned char NImage = 0;
4747
std::vector<unsigned char> Bin{NImage++};
4848

49-
std::vector<UrOffloadEntry> Entries = makeEmptyKernels(KernelNames);
49+
std::vector<MockOffloadEntry> Entries = makeEmptyKernels(KernelNames);
5050

51-
UrImage Img{BinaryType, // Format
52-
DeviceTargetSpec,
53-
"", // Compile options
54-
"", // Link options
55-
std::move(Bin),
56-
std::move(Entries),
57-
std::move(PropSet)};
51+
MockDeviceImage Img{BinaryType, // Format
52+
DeviceTargetSpec,
53+
"", // Compile options
54+
"", // Link options
55+
std::move(Bin),
56+
std::move(Entries),
57+
std::move(PropSet)};
5858
const void *BinaryPtr = Img.getBinaryPtr();
5959
TrackedImages.insert(BinaryPtr);
6060

@@ -69,7 +69,7 @@ generateDefaultImage(std::initializer_list<std::string> KernelNames,
6969
// Image 5: input, KernelE
7070
// Image 6: exe, KernelE
7171
// Image 7: exe. KernelE
72-
sycl::unittest::UrImage Imgs[] = {
72+
sycl::unittest::MockDeviceImage Imgs[] = {
7373
generateDefaultImage({"KernelA", "KernelB"}, SYCL_DEVICE_BINARY_TYPE_SPIRV,
7474
__SYCL_DEVICE_BINARY_TARGET_SPIRV64),
7575
generateDefaultImage({"KernelA"}, SYCL_DEVICE_BINARY_TYPE_NATIVE,
@@ -87,7 +87,7 @@ sycl::unittest::UrImage Imgs[] = {
8787
generateDefaultImage({"KernelE"}, SYCL_DEVICE_BINARY_TYPE_NATIVE,
8888
__SYCL_DEVICE_BINARY_TARGET_SPIRV64_X86_64)};
8989

90-
sycl::unittest::UrImageArray<std::size(Imgs)> ImgArray{Imgs};
90+
sycl::unittest::MockDeviceImageArray<std::size(Imgs)> ImgArray{Imgs};
9191
std::vector<unsigned char> UsedImageIndices;
9292

9393
void redefinedUrProgramCreateCommon(const void *bin) {

sycl/unittests/SYCL2020/KernelID.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include <sycl/sycl.hpp>
1010

11+
#include <helpers/MockDeviceImage.hpp>
1112
#include <helpers/MockKernelInfo.hpp>
12-
#include <helpers/UrImage.hpp>
1313
#include <helpers/UrMock.hpp>
1414

1515
#include <gtest/gtest.h>
@@ -47,13 +47,13 @@ struct KernelInfo<ServiceKernel1> : public unittest::MockKernelInfoBase {
4747
} // namespace _V1
4848
} // namespace sycl
4949

50-
static sycl::unittest::UrImage Imgs[2] = {
50+
static sycl::unittest::MockDeviceImage Imgs[2] = {
5151
sycl::unittest::generateDefaultImage(
5252
{"KernelID_TestKernel1", "KernelID_TestKernel3"}),
5353
sycl::unittest::generateDefaultImage(
5454
{"KernelID_TestKernel2",
5555
"_ZTSN2cl4sycl6detail23__sycl_service_kernel__14ServiceKernel1"})};
56-
static sycl::unittest::UrImageArray<2> ImgArray{Imgs};
56+
static sycl::unittest::MockDeviceImageArray<2> ImgArray{Imgs};
5757

5858
TEST(KernelID, AllProgramKernelIds) {
5959
std::vector<sycl::kernel_id> AllKernelIDs = sycl::get_kernel_ids();

0 commit comments

Comments
 (0)