Skip to content

Commit 6a948cd

Browse files
authored
[SYCL][Bindless][E2E] Improve bindless images E2E test times (#15490)
A significant number of bindless images tests use image sizes that are far larger then necessary. This commit reduces them to decrease times that bindless images tests take to complete and adds deterministic varying of local and global sizes in bindless tests.
1 parent 11353c6 commit 6a948cd

File tree

7 files changed

+715
-287
lines changed

7 files changed

+715
-287
lines changed

sycl/test-e2e/bindless_images/array/fetch_sampled_array.cpp

Lines changed: 170 additions & 72 deletions
Large diffs are not rendered by default.

sycl/test-e2e/bindless_images/array/read_sampled_array.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,9 @@ int main() {
616616

617617
unsigned int seed = 0;
618618
std::cout << "Running 1D Sampled Image Array Tests!\n";
619-
bool result1D = runAll<2>({64, 32}, {16, 16}, 20, seed);
619+
bool result1D = runAll<2>({16, 16}, {8, 8}, 20, seed);
620620
std::cout << "Running 2D Sampled Image Array Tests!\n";
621-
bool result2D = runAll<3>({64, 32, 16}, {16, 16, 4}, 20, seed);
621+
bool result2D = runAll<3>({16, 8, 4}, {8, 8, 2}, 20, seed);
622622

623623
if (result1D && result2D) {
624624
std::cout << "All tests passed!\n";

sycl/test-e2e/bindless_images/array/read_write_unsampled_array.cpp

Lines changed: 168 additions & 71 deletions
Large diffs are not rendered by default.

sycl/test-e2e/bindless_images/cubemap/cubemap_unsampled.cpp

Lines changed: 80 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -171,99 +171,148 @@ void printTestName(std::string name) {
171171
#endif
172172
}
173173

174+
sycl::range<2> getCubeGlobal(size_t index) {
175+
const std::vector<sycl::range<2>> globalSizes = {{6, 6}, {10, 10}, {8, 8}};
176+
177+
return globalSizes[index % 3];
178+
}
179+
180+
sycl::range<3> getCubeLocal(size_t index) {
181+
182+
const std::vector<sycl::range<3>> localSizes = {
183+
{3, 3, 1}, {5, 5, 3}, {4, 4, 2}};
184+
185+
return localSizes[index % 3];
186+
}
187+
174188
int main() {
175189

176190
unsigned int seed = 0;
177191
bool failed = false;
192+
int sizeIndex = 0;
178193

179194
printTestName("Running cube int\n");
180195
failed |= run_test<int32_t, 1, sycl::image_channel_type::signed_int32,
181-
class int_cube>({32, 32}, {16, 16, 2}, seed);
196+
class int_cube>(getCubeGlobal(sizeIndex),
197+
getCubeLocal(sizeIndex), seed);
198+
sizeIndex++;
182199
printTestName("Running cube int2\n");
183200
failed |= run_test<int32_t, 2, sycl::image_channel_type::signed_int32,
184-
class int2_cube>({128, 128}, {16, 16, 3}, seed);
201+
class int2_cube>(getCubeGlobal(sizeIndex),
202+
getCubeLocal(sizeIndex), seed);
203+
sizeIndex++;
185204
printTestName("Running cube int4\n");
186205
failed |= run_test<int32_t, 4, sycl::image_channel_type::signed_int32,
187-
class int4_cube>({64, 64}, {32, 16, 1}, seed);
188-
206+
class int4_cube>(getCubeGlobal(sizeIndex),
207+
getCubeLocal(sizeIndex), seed);
208+
sizeIndex++;
189209
printTestName("Running cube unsigned int\n");
190210
failed |= run_test<uint32_t, 1, sycl::image_channel_type::unsigned_int32,
191-
class uint_cube>({15, 15}, {5, 3, 1}, seed);
211+
class uint_cube>(getCubeGlobal(sizeIndex),
212+
getCubeLocal(sizeIndex), seed);
213+
sizeIndex++;
192214
printTestName("Running cube unsigned int2\n");
193215
failed |= run_test<uint32_t, 2, sycl::image_channel_type::unsigned_int32,
194-
class uint2_cube>({90, 90}, {10, 9, 3}, seed);
216+
class uint2_cube>(getCubeGlobal(sizeIndex),
217+
getCubeLocal(sizeIndex), seed);
218+
sizeIndex++;
195219
printTestName("Running cube unsigned int4\n");
196220
failed |= run_test<uint32_t, 4, sycl::image_channel_type::unsigned_int32,
197-
class uint4_cube>({1024, 1024}, {16, 16, 2}, seed);
198-
221+
class uint4_cube>(getCubeGlobal(sizeIndex),
222+
getCubeLocal(sizeIndex), seed);
223+
sizeIndex++;
199224
printTestName("Running cube short\n");
200225
failed |= run_test<short, 1, sycl::image_channel_type::signed_int16,
201-
class short_cube>({8, 8}, {2, 2, 1}, seed);
226+
class short_cube>(getCubeGlobal(sizeIndex),
227+
getCubeLocal(sizeIndex), seed);
228+
sizeIndex++;
202229
printTestName("Running cube short2\n");
203230
failed |= run_test<short, 2, sycl::image_channel_type::signed_int16,
204-
class short2_cube>({8, 8}, {4, 4, 2}, seed);
231+
class short2_cube>(getCubeGlobal(sizeIndex),
232+
getCubeLocal(sizeIndex), seed);
233+
sizeIndex++;
205234
printTestName("Running cube short4\n");
206235
failed |= run_test<short, 4, sycl::image_channel_type::signed_int16,
207-
class short4_cube>({8, 8}, {8, 8, 3}, seed);
208-
236+
class short4_cube>(getCubeGlobal(sizeIndex),
237+
getCubeLocal(sizeIndex), seed);
238+
sizeIndex++;
209239
printTestName("Running cube unsigned short\n");
210240
failed |=
211241
run_test<unsigned short, 1, sycl::image_channel_type::unsigned_int16,
212-
class ushort_cube>({75, 75}, {25, 5, 1}, seed);
242+
class ushort_cube>(getCubeGlobal(sizeIndex),
243+
getCubeLocal(sizeIndex), seed);
244+
sizeIndex++;
213245
printTestName("Running cube unsigned short2\n");
214246
failed |=
215247
run_test<unsigned short, 2, sycl::image_channel_type::unsigned_int16,
216-
class ushort2_cube>({75, 75}, {15, 3, 2}, seed);
248+
class ushort2_cube>(getCubeGlobal(sizeIndex),
249+
getCubeLocal(sizeIndex), seed);
250+
sizeIndex++;
217251
printTestName("Running cube unsigned short4\n");
218252
failed |=
219253
run_test<unsigned short, 4, sycl::image_channel_type::unsigned_int16,
220-
class ushort4_cube>({75, 75}, {5, 25, 3}, seed);
221-
254+
class ushort4_cube>(getCubeGlobal(sizeIndex),
255+
getCubeLocal(sizeIndex), seed);
256+
sizeIndex++;
222257
printTestName("Running cube char\n");
223258
failed |= run_test<signed char, 1, sycl::image_channel_type::signed_int8,
224-
class char_cube>({60, 60}, {10, 6, 1}, seed);
259+
class char_cube>(getCubeGlobal(sizeIndex),
260+
getCubeLocal(sizeIndex), seed);
261+
sizeIndex++;
225262
printTestName("Running cube char2\n");
226263
failed |= run_test<signed char, 2, sycl::image_channel_type::signed_int8,
227-
class char2_cube>({60, 60}, {5, 3, 2}, seed);
264+
class char2_cube>(getCubeGlobal(sizeIndex),
265+
getCubeLocal(sizeIndex), seed);
266+
sizeIndex++;
228267
printTestName("Running cube char4\n");
229268
failed |= run_test<signed char, 4, sycl::image_channel_type::signed_int8,
230-
class char4_cube>({60, 60}, {6, 10, 3}, seed);
231-
269+
class char4_cube>(getCubeGlobal(sizeIndex),
270+
getCubeLocal(sizeIndex), seed);
271+
sizeIndex++;
232272
printTestName("Running cube unsigned char\n");
233273
failed |= run_test<unsigned char, 1, sycl::image_channel_type::unsigned_int8,
234-
class uchar_cube>({128, 128}, {16, 16, 3}, seed);
274+
class uchar_cube>(getCubeGlobal(sizeIndex),
275+
getCubeLocal(sizeIndex), seed);
276+
sizeIndex++;
235277
printTestName("Running cube unsigned char2\n");
236278
failed |= run_test<unsigned char, 2, sycl::image_channel_type::unsigned_int8,
237-
class uchar2_cube>({128, 128}, {16, 16, 3}, seed);
279+
class uchar2_cube>(getCubeGlobal(sizeIndex),
280+
getCubeLocal(sizeIndex), seed);
281+
sizeIndex++;
238282
printTestName("Running cube unsigned char4\n");
239283
failed |= run_test<unsigned char, 4, sycl::image_channel_type::unsigned_int8,
240-
class uchar4_cube>({128, 128}, {16, 16, 3}, seed);
241-
284+
class uchar4_cube>(getCubeGlobal(sizeIndex),
285+
getCubeLocal(sizeIndex), seed);
286+
sizeIndex++;
242287
printTestName("Running cube float\n");
243288
failed |=
244289
run_test<float, 1, sycl::image_channel_type::fp32, class float_cube>(
245-
{1024, 1024}, {16, 16, 1}, seed);
290+
getCubeGlobal(sizeIndex), getCubeLocal(sizeIndex), seed);
291+
sizeIndex++;
246292
printTestName("Running cube float2\n");
247293
failed |=
248294
run_test<float, 2, sycl::image_channel_type::fp32, class float2_cube>(
249-
{1024, 1024}, {16, 16, 3}, seed);
295+
getCubeGlobal(sizeIndex), getCubeLocal(sizeIndex), seed);
296+
sizeIndex++;
250297
printTestName("Running cube float4\n");
251298
failed |=
252299
run_test<float, 4, sycl::image_channel_type::fp32, class float4_cube>(
253-
{1024, 1024}, {16, 16, 2}, seed);
254-
300+
getCubeGlobal(sizeIndex), getCubeLocal(sizeIndex), seed);
301+
sizeIndex++;
255302
printTestName("Running cube half\n");
256303
failed |=
257304
run_test<sycl::half, 1, sycl::image_channel_type::fp16, class half_cube>(
258-
{48, 48}, {8, 8, 1}, seed);
305+
getCubeGlobal(sizeIndex), getCubeLocal(sizeIndex), seed);
306+
sizeIndex++;
259307
printTestName("Running cube half2\n");
260308
failed |=
261309
run_test<sycl::half, 2, sycl::image_channel_type::fp16, class half2_cube>(
262-
{48, 48}, {8, 8, 3}, seed);
310+
getCubeGlobal(sizeIndex), getCubeLocal(sizeIndex), seed);
311+
sizeIndex++;
263312
printTestName("Running cube half4\n");
264313
failed |=
265314
run_test<sycl::half, 4, sycl::image_channel_type::fp16, class half4_cube>(
266-
{48, 48}, {8, 8, 2}, seed);
315+
getCubeGlobal(sizeIndex), getCubeLocal(sizeIndex), seed);
267316

268317
if (failed) {
269318
std::cerr << "An error has occured!\n";

sycl/test-e2e/bindless_images/helpers/common.hpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,52 @@ template <int NDims> struct ImageArrayDims {
184184
unsigned int array_count;
185185
};
186186

187+
template <int NDims> static sycl::range<NDims> getGlobalSize(size_t index) {
188+
189+
const std::vector<sycl::range<1>> globalSizes1D = {{32}, {16}, {20},
190+
{9}, {14}, {2}};
191+
const std::vector<sycl::range<2>> globalSizes2D = {{32, 16}, {8, 32}, {20, 5},
192+
{3, 9}, {14, 7}, {2, 2}};
193+
const std::vector<sycl::range<3>> globalSizes3D = {
194+
{16, 8, 4}, {2, 6, 12}, {10, 15, 5}, {9, 6, 3}, {15, 7, 3}, {2, 2, 2}};
195+
196+
const size_t globalIndex = index % 6;
197+
198+
if constexpr (NDims == 1) {
199+
return {globalSizes1D[globalIndex]};
200+
}
201+
202+
if constexpr (NDims == 2) {
203+
return {globalSizes2D[globalIndex]};
204+
}
205+
206+
if constexpr (NDims == 3) {
207+
return {globalSizes3D[globalIndex]};
208+
}
209+
}
210+
211+
template <int NDims> static sycl::range<NDims> getLocalSize(size_t index) {
212+
213+
const std::vector<sycl::range<1>> localSizes1D = {{2}, {16}, {5},
214+
{3}, {7}, {1}};
215+
const std::vector<sycl::range<2>> localSizes2D = {{16, 4}, {2, 32}, {5, 5},
216+
{3, 3}, {7, 7}, {1, 1}};
217+
const std::vector<sycl::range<3>> localSizes3D = {
218+
{8, 4, 2}, {1, 3, 12}, {5, 5, 5}, {3, 3, 3}, {5, 7, 3}, {1, 1, 1}};
219+
220+
const size_t localIndex = index % 6;
221+
222+
if constexpr (NDims == 1) {
223+
return localSizes1D[localIndex];
224+
}
225+
226+
if constexpr (NDims == 2) {
227+
return localSizes2D[localIndex];
228+
}
229+
230+
if constexpr (NDims == 3) {
231+
return localSizes3D[localIndex];
232+
}
233+
}
234+
187235
}; // namespace bindless_helpers

sycl/test-e2e/bindless_images/read_sampled.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,13 @@ bool runAll(sycl::range<NDims> dims, sycl::range<NDims> localSize, float offset,
636636

637637
int main() {
638638

639-
unsigned int seed = 0;
639+
const unsigned int seed = 0;
640+
const float offset = 20.0;
641+
640642
std::cout << "Running 1D Sampled Image Tests!\n";
641-
bool result1D = runAll<1>({256}, {32}, 20, seed);
643+
bool result1D = runAll<1>({128}, {32}, offset, seed);
642644
std::cout << "Running 2D Sampled Image Tests!\n";
643-
bool result2D = runAll<2>({256, 256}, {32, 32}, 20, seed);
645+
bool result2D = runAll<2>({16, 16}, {8, 8}, offset, seed);
644646

645647
if (result1D && result2D) {
646648
std::cout << "All tests passed!\n";

0 commit comments

Comments
 (0)