JuliaGPU / JuliaGPU/oneAPI.jl

Correctness issue when indexing "big" `oneArray`s

Open
#509 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
215
Forks
37
Avg merge
10h 47m
Merged PRs (30d)
14

Description

I was debugging some [Buildkite CI errors](https://buildkite.com/julialang/komamri-dot-jl/builds/1617) in KomaMRI and narrowed the issue down to indexing into a matrix that's “too big.” This is a MWE:

```julia
using oneAPI
x = randn(Float32, 513, 3)
x_one = convert(oneArray, x)
```

```julia-repl
julia> y = x[:, 1:2]
513×2 Matrix{Float32}:
-0.785065 0.605889
-0.138269 -0.886778
-0.418909 -0.302653
-0.0957128 -0.974546

-0.486535 -0.594906
1.42615 -1.00182
0.0519026 -0.0332484

julia> y_one = x_one[:, 1:2]
513×2 oneArray{Float32, 2, oneAPI.oneL0.DeviceBuffer}:
-0.785065 0.0
-0.138269 0.0
-0.418909 0.0
-0.0957128 0.0

-0.486535 0.0
1.42615 -1.00182
0.0519026 -0.0332484
```
Which is very interesting, as it does not happen when using `view`s:

```julia-repl
julia> y = @view x[:, 1:2]
513×2 view(::Matrix{Float32}, :, 1:2) with eltype Float32:
-0.785065 0.605889
-0.138269 -0.886778
-0.418909 -0.302653
-0.0957128 -0.974546

-0.486535 -0.594906
1.42615 -1.00182
0.0519026 -0.0332484

julia> y_one = @view x_one[:, 1:2]
513×2 oneArray{Float32, 2, oneAPI.oneL0.DeviceBuffer}:
-0.785065 0.605889
-0.138269 -0.886778
-0.418909 -0.302653
-0.0957128 -0.974546

-0.486535 -0.594906
1.42615 -1.00182
0.0519026 -0.0332484
```

I am using Julia 1.11.6 and oneAPI 2.0.3. Not really sure what could be the cause, but when I use `x = randn(Float32, 512, 3)` it starts working again, so it seems to be related to the size of the array.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided Julia MWE with oneAPI 2.0.3, comparing ordinary indexing with the working @view case for 513×3 and 512×3 arrays. Trace the indexing path responsible for copying x_one[:, 1:2]; done means the copied result preserves both columns for the larger array, with a regression test covering the boundary size.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
hpc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.