@@ -86,7 +86,8 @@ static ur_result_t redefinedKernelRelease(void *) {
86
86
return UR_RESULT_SUCCESS;
87
87
}
88
88
89
- class MultipleDeviceCacheTest : public ::testing::Test {
89
+ class MultipleDeviceCacheTest
90
+ : public testing::TestWithParam<std::array<size_t , NumDevices>> {
90
91
public:
91
92
MultipleDeviceCacheTest () : Mock{}, Plt{sycl::platform ()} {}
92
93
@@ -109,17 +110,25 @@ class MultipleDeviceCacheTest : public ::testing::Test {
109
110
110
111
// Test that program is retained for each subset of the list of devices and that
111
112
// number of urKernelRelease calls is correct.
112
- TEST_F (MultipleDeviceCacheTest, ProgramRetain) {
113
+ TEST_P (MultipleDeviceCacheTest, ProgramRetain) {
113
114
{
115
+ // Reset counters
116
+ RetainCounter = 0 ;
117
+ KernelReleaseCounter = 0 ;
118
+
114
119
std::vector<sycl::device> Devices = Plt.get_devices (info::device_type::gpu);
115
120
sycl::context Context (Devices);
116
121
sycl::queue Queue (Context, Devices[0 ]);
117
122
assert (Devices.size () == NumDevices &&
118
123
Context.get_devices ().size () == NumDevices);
119
124
125
+ auto DeviceIndexes = GetParam ();
120
126
auto KernelID = sycl::get_kernel_id<MultipleDevsCacheTestKernel>();
121
127
auto Bundle = sycl::get_kernel_bundle<sycl::bundle_state::input>(
122
- Queue.get_context (), {KernelID});
128
+ Queue.get_context (),
129
+ {Devices[DeviceIndexes[0 ]], Devices[DeviceIndexes[1 ]],
130
+ Devices[DeviceIndexes[2 ]]},
131
+ {KernelID});
123
132
assert (Bundle.get_devices ().size () == NumDevices);
124
133
125
134
// Internally we create a kernel_bundle for the device associated with the
@@ -178,3 +187,9 @@ TEST_F(MultipleDeviceCacheTest, ProgramRetain) {
178
187
// when handle is returned to the caller).
179
188
EXPECT_EQ (KernelReleaseCounter, 4 ) << " Expect 4 piKernelRelease calls" ;
180
189
}
190
+
191
+ INSTANTIATE_TEST_SUITE_P (
192
+ MultipleDeviceCacheInstance, MultipleDeviceCacheTest,
193
+ testing::Values (std::array<size_t , NumDevices>{0 , 1 , 2 },
194
+ std::array<size_t , NumDevices>{1 , 0 , 2 },
195
+ std::array<size_t , NumDevices>{2 , 1 , 0 }));
0 commit comments