Skip to content

Commit 504d533

Browse files
[Matrix][SYCL] Add explicit conversion in wi_element when it is necessary (#5279)
Previously, there was a potential issue of deduced conflicting types because we didn't take integral promotion into consideration Now, we add explicit conversion where integral promotion might happen to avoid such issues to appear.
1 parent aa227b1 commit 504d533

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sycl/include/sycl/ext/oneapi/matrix/matrix-jit.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ class wi_element {
287287
wi_element &operator+=(const T &rhs) {
288288
#ifdef __SYCL_DEVICE_ONLY__
289289
M.spvm = __spirv_VectorInsertDynamic(
290-
M.spvm, __spirv_VectorExtractDynamic(M.spvm, idx) + rhs, idx);
290+
M.spvm, static_cast<T>(__spirv_VectorExtractDynamic(M.spvm, idx) + rhs),
291+
idx);
291292
return *this;
292293
#else
293294
(void)rhs;
@@ -311,7 +312,8 @@ class wi_element {
311312
wi_element &operator-=(const T &rhs) {
312313
#ifdef __SYCL_DEVICE_ONLY__
313314
M.spvm = __spirv_VectorInsertDynamic(
314-
M.spvm, __spirv_VectorExtractDynamic(M.spvm, idx) - rhs, idx);
315+
M.spvm, static_cast<T>(__spirv_VectorExtractDynamic(M.spvm, idx) - rhs),
316+
idx);
315317
return *this;
316318
#else
317319
(void)rhs;
@@ -335,7 +337,8 @@ class wi_element {
335337
wi_element &operator*=(const T &rhs) {
336338
#ifdef __SYCL_DEVICE_ONLY__
337339
M.spvm = __spirv_VectorInsertDynamic(
338-
M.spvm, __spirv_VectorExtractDynamic(M.spvm, idx) * rhs, idx);
340+
M.spvm, static_cast<T>(__spirv_VectorExtractDynamic(M.spvm, idx) * rhs),
341+
idx);
339342
return *this;
340343
#else
341344
(void)rhs;
@@ -359,7 +362,8 @@ class wi_element {
359362
wi_element &operator/=(const T &rhs) {
360363
#ifdef __SYCL_DEVICE_ONLY__
361364
M.spvm = __spirv_VectorInsertDynamic(
362-
M.spvm, __spirv_VectorExtractDynamic(M.spvm, idx) / rhs, idx);
365+
M.spvm, static_cast<T>(__spirv_VectorExtractDynamic(M.spvm, idx) / rhs),
366+
idx);
363367
return *this;
364368
#else
365369
(void)rhs;

0 commit comments

Comments
 (0)