Skip to content

Commit b6b1355

Browse files
kala855sgeor255
authored andcommitted
gpu: generic: sycl: lnorm: Intel GPU precision issues
1 parent db382e0 commit b6b1355

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/benchdnn/lnorm/lnorm.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,17 @@ void setup_cmp(compare::compare_t &cmp, const prb_t *prb, data_kind_t kind,
450450
// exceeds `digits_f32`.
451451
const int safe_digits = MAX2(0, digits_dt(dnnl_f32) - digits_dt(dt));
452452
const float trh_coeff = (1 << safe_digits);
453+
// The following code is a workaround because a SYCL compiler bug
454+
// that is causing precision issues.
455+
#ifdef DNNL_WITH_SYCL
456+
float trh = trh_coeff
457+
* ((kind == SRC || kind == DST
458+
|| (kind == VAR && prb->dir & FLAG_FWD))
459+
? 5e-7
460+
: 0);
461+
#else
453462
float trh = trh_coeff * ((kind == SRC || kind == DST) ? 5e-7 : 0);
463+
#endif
454464
if ((kind == SC || kind == SH) && prb->dir & FLAG_BWD)
455465
trh = trh_coeff * 5e-6;
456466
cmp.set_threshold(trh);

0 commit comments

Comments
 (0)