intel / intel/llvm

Wrong results from joint_matrix_apply

Open
#21,409 2 comments 1 reaction 1 assignee Claimed by @dkhaldi View on GitHub
bug confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

### Describe the bug

joint_matrix_apply can't get the correct matrix result.

### To reproduce

Code to reproduce the bug:
```
sycl::ext::oneapi::experimental::matrix::joint_matrix<
sycl::sub_group, DT, use::accumulator, TM, TN>
sub_c[SGM * SGN];
#pragma unroll
for (int im = 0; im < SGM; im++)
#pragma unroll
for (int in = 0; in < SGN; in++)
joint_matrix_fill(sg, sub_c[im * SGN + in], DT(1.f));

#pragma unroll
for (int im = 0; im < SGM; im++)
#pragma unroll
for (int in = 0; in < SGN; in++) {
joint_matrix_apply(sg, sub_c[im * SGN + in],
[=](DT &x) { x += DT(1); });
joint_matrix_store(sg, sub_c[im * SGN + in],
pC + im * TM * n + in * TN, n,
layout::row_major);
}

```

cmd to compile:
`icpx -fsycl main.cpp -o main`

If SGM=1 and SGN=1, the store value is wrong, as:
```
Running on: Intel(R) Arc(TM) Pro B60 Graphics
--- Matrix 16x16 (sycl::half) ---
17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
```
It should be a 16x16 matrix with all 2.00.

### Environment

- OS: Ubuntu 24.04
- Target device and vendor: Intel(R) Arc(TM) Pro B60
- DPC++ version: Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2025.2.1 Build 20250806 and Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2025.3.0 Build 20251010
- Dependencies version: [level_zero:gpu][level_zero:0] Intel(R) oneAPI Unified Runtime over Level-Zero, Intel(R) Arc(TM) Pro B60 Graphics 20.1.0 [1.14.37020+3]

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.