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

Commit 2da7640

Browse files
[SYCL] Fix failures on tests that use double datatype (#1246)
1 parent b8c39f4 commit 2da7640

File tree

4 files changed

+28
-23
lines changed

4 files changed

+28
-23
lines changed

SYCL/ESIMD/regression/Inputs/dgetrf.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,10 @@ ESIMD_INLINE void dgetrfnp_esimd(int64_t m, int64_t n, double *a, int64_t lda,
298298
#endif // defined(USE_REF)
299299
}
300300

301-
void dgetrfnp_batch_strided_c(int64_t m, int64_t n, double *a, int64_t lda,
302-
int64_t stride_a, int64_t *ipiv,
301+
void dgetrfnp_batch_strided_c(queue &queue, int64_t m, int64_t n, double *a,
302+
int64_t lda, int64_t stride_a, int64_t *ipiv,
303303
int64_t stride_ipiv, int64_t batch,
304304
int64_t *info) {
305-
queue queue((gpu_selector()));
306305
auto device = queue.get_device();
307306
auto context = queue.get_context();
308307
int status;
@@ -446,6 +445,11 @@ void dgetrfnp_batch_strided_c(int64_t m, int64_t n, double *a, int64_t lda,
446445
int64_t *info);
447446

448447
int main(int argc, char *argv[]) {
448+
queue queue((gpu_selector()));
449+
450+
if (!queue.get_device().has(aspect::fp64))
451+
return 0;
452+
449453
int exit_status = 0;
450454
int64_t m = 64, n = 64, lda = 64;
451455
int64_t stride_a = lda * n, stride_ipiv = n;
@@ -472,8 +476,8 @@ int main(int argc, char *argv[]) {
472476
}
473477

474478
/* Run the tested function */
475-
dgetrfnp_batch_strided_c(m, n, a, lda, stride_a, ipiv, stride_ipiv, batch,
476-
info);
479+
dgetrfnp_batch_strided_c(queue, m, n, a, lda, stride_a, ipiv, stride_ipiv,
480+
batch, info);
477481

478482
/* Check that the computation completed successfully */
479483
exit_status += dgetrfnp_batch_strided_check(m, n, a_copy, a, lda, stride_a,

SYCL/ESIMD/regression/dgetrf_8x8.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,10 @@ ESIMD_INLINE void dgetrfnp_esimd_8x8(double *a, int64_t lda, int64_t *ipiv,
125125
dgetrfnp_left_step<8, 8, 0>(a, lda, info);
126126
}
127127

128-
void dgetrfnp_batch_strided_c(int64_t m, int64_t n, double *a, int64_t lda,
129-
int64_t stride_a, int64_t *ipiv,
128+
void dgetrfnp_batch_strided_c(queue &queue, int64_t m, int64_t n, double *a,
129+
int64_t lda, int64_t stride_a, int64_t *ipiv,
130130
int64_t stride_ipiv, int64_t batch,
131131
int64_t *info) {
132-
queue queue((gpu_selector()));
133132
auto device = queue.get_device();
134133
auto context = queue.get_context();
135134
int status;
@@ -267,12 +266,12 @@ static int dgetrfnp_batch_strided_check(int64_t m, int64_t n, double *a_in,
267266
return fail;
268267
}
269268

270-
void dgetrfnp_batch_strided_c(int64_t m, int64_t n, double *a, int64_t lda,
271-
int64_t stride_a, int64_t *ipiv,
272-
int64_t stride_ipiv, int64_t batch,
273-
int64_t *info);
274-
275269
int main(int argc, char *argv[]) {
270+
queue queue((gpu_selector()));
271+
272+
if (!queue.get_device().has(aspect::fp64))
273+
return 0;
274+
276275
int exit_status = 0;
277276
constexpr int64_t m = 8, n = 8, lda = 8;
278277
int64_t stride_a = lda * n, stride_ipiv = n;
@@ -299,8 +298,8 @@ int main(int argc, char *argv[]) {
299298
}
300299

301300
/* Run the tested function */
302-
dgetrfnp_batch_strided_c(m, n, a, lda, stride_a, ipiv, stride_ipiv, batch,
303-
info);
301+
dgetrfnp_batch_strided_c(queue, m, n, a, lda, stride_a, ipiv, stride_ipiv,
302+
batch, info);
304303

305304
/* Check that the computation completed successfully */
306305
exit_status += dgetrfnp_batch_strided_check(m, n, a_copy, a, lda, stride_a,

SYCL/ESIMD/spec_const/Inputs/spec-const-2020-common.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ int main(int argc, char **argv) {
3939
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
4040

4141
auto dev = q.get_device();
42+
if (std::is_same_v<spec_const_t, double> && !dev.has(aspect::fp64))
43+
return 0;
4244
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
4345

4446
std::vector<container_t> etalon = {DEF_VAL, REDEF_VAL};

SYCL/KernelParams/union_kernel_param.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ union TestUnion {
1212
public:
1313
int myint;
1414
char mychar;
15-
double mydouble;
15+
float myfloat;
1616

17-
TestUnion() { mydouble = 0.0; };
17+
TestUnion() { myfloat = 0.0f; };
1818
};
1919

2020
int main(int argc, char **argv) {
2121
TestUnion x;
22-
x.mydouble = 5.0;
23-
double mydouble = 0.0;
22+
x.myfloat = 5.0f;
23+
float myfloat = 0.0f;
2424

2525
sycl::queue queue;
2626
{
27-
sycl::buffer<double, 1> buf(&mydouble, 1);
27+
sycl::buffer<float, 1> buf(&myfloat, 1);
2828
queue.submit([&](sycl::handler &cgh) {
2929
auto acc = buf.get_access<sycl::access::mode::read_write>(cgh);
30-
cgh.single_task<class test>([=]() { acc[0] = x.mydouble; });
30+
cgh.single_task<class test>([=]() { acc[0] = x.myfloat; });
3131
});
3232
}
3333

34-
if (mydouble != 5.0) {
35-
printf("FAILED\nmydouble = %d\n", mydouble);
34+
if (myfloat != 5.0f) {
35+
printf("FAILED\nmyfloat = %d\n", myfloat);
3636
return 1;
3737
}
3838
return 0;

0 commit comments

Comments
 (0)