Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 87c8ce6

Browse files
[ESIMD] Fix stencil tests timeouts (#244)
* [ESIMD] Fix stencil tests timeouts I analyzed the history of ESIMD stencil tests in CI and found that stencil tests are sensitive to the time limit. I.e. they are not hanging but timing out before finishing the job. Since #148 Stencil.cpp was failing several times per day. This patch reduces back the working set for the two tests allowing them to finish before in required time limit. Also, added a test parameter to run with a bigger dimension size. * Address review comments
1 parent 73cb088 commit 87c8ce6

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

SYCL/ESIMD/Stencil.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==---------------- stencil.cpp - DPC++ ESIMD on-device test ------------==//
1+
//==---------------- Stencil.cpp - DPC++ ESIMD on-device test ------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -17,13 +17,6 @@
1717
#include <CL/sycl/INTEL/esimd.hpp>
1818
#include <iostream>
1919

20-
//
21-
// test smaller input size
22-
// test 8x16 block size
23-
//
24-
#define DIM_SIZE (1 << 13)
25-
#define SQUARE_SZ (DIM_SIZE * DIM_SIZE + 16)
26-
2720
#define WIDTH 16
2821
#define HEIGHT 16
2922

@@ -41,8 +34,7 @@ void InitializeSquareMatrix(float *matrix, size_t const Dim,
4134
}
4235
}
4336

44-
bool CheckResults(float *out, float *in) {
45-
unsigned int n = DIM_SIZE;
37+
bool CheckResults(float *out, float *in, unsigned n) {
4638
for (unsigned int i = 0; i < n; i++) {
4739
for (unsigned int j = 0; j < n; j++) {
4840
if ((5 <= i) && (i < n - 5) && (5 <= j) && (j < n - 5)) {
@@ -79,7 +71,14 @@ bool CheckResults(float *out, float *in) {
7971
return true;
8072
}
8173

82-
int main(void) {
74+
int main(int argc, char *argv[]) {
75+
if (argc > 2) {
76+
std::cerr << "Usage: stencil.exe [dim_size]" << std::endl;
77+
exit(1);
78+
}
79+
// Default dimension size is 1024
80+
const unsigned DIM_SIZE = (argc == 2) ? atoi(argv[1]) : 1 << 10;
81+
const unsigned SQUARE_SZ = DIM_SIZE * DIM_SIZE + 16;
8382
uint range_width =
8483
(DIM_SIZE - 10) / WIDTH + (((DIM_SIZE - 10) % WIDTH == 0) ? 0 : 1);
8584
uint range_height =
@@ -182,7 +181,7 @@ int main(void) {
182181
}
183182

184183
// check result
185-
bool passed = CheckResults(outputMatrix, inputMatrix);
184+
bool passed = CheckResults(outputMatrix, inputMatrix, DIM_SIZE);
186185
if (passed) {
187186
std::cout << "PASSED" << std::endl;
188187
} else {

SYCL/ESIMD/stencil2.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
#include <CL/sycl/INTEL/esimd.hpp>
1818
#include <iostream>
1919

20-
//
21-
// test smaller input size
22-
// test 8x16 block size
23-
//
24-
#define DIM_SIZE (1 << 13)
25-
#define SQUARE_SZ (DIM_SIZE * DIM_SIZE + 16)
26-
2720
#define WIDTH 16
2821
#define HEIGHT 16
2922

@@ -43,8 +36,7 @@ void InitializeSquareMatrix(float *matrix, size_t const Dim,
4336
}
4437
}
4538

46-
bool CheckResults(float *out, float *in) {
47-
unsigned int n = DIM_SIZE;
39+
bool CheckResults(float *out, float *in, unsigned n) {
4840
for (unsigned int i = 0; i < n; i++) {
4941
for (unsigned int j = 0; j < n; j++) {
5042
if ((5 <= i) && (i < n - 5) && (5 <= j) && (j < n - 5)) {
@@ -81,7 +73,14 @@ bool CheckResults(float *out, float *in) {
8173
return true;
8274
}
8375

84-
int main(void) {
76+
int main(int argc, char *argv[]) {
77+
if (argc > 2) {
78+
std::cerr << "Usage: stencil.exe [dim_size]" << std::endl;
79+
exit(1);
80+
}
81+
// Default dimension size is 1024
82+
const unsigned DIM_SIZE = (argc == 2) ? atoi(argv[1]) : 1 << 10;
83+
const unsigned SQUARE_SZ = DIM_SIZE * DIM_SIZE + 16;
8584
uint range_width =
8685
(DIM_SIZE - 10) / WIDTH + (((DIM_SIZE - 10) % WIDTH == 0) ? 0 : 1);
8786
uint range_height =
@@ -184,7 +183,7 @@ int main(void) {
184183
}
185184

186185
// check result
187-
bool passed = CheckResults(outputMatrix, inputMatrix);
186+
bool passed = CheckResults(outputMatrix, inputMatrix, DIM_SIZE);
188187
if (passed) {
189188
std::cout << "PASSED" << std::endl;
190189
} else {

0 commit comments

Comments
 (0)