Repository navigation
Open
Description
On the oneAPI backend, indexing a 1-D array that is a slice with a non-zero offset (e.g. data(af::seq(10, 29))) by an index array returns elements counted from the start of the underlying array instead of from the slice.
Description
- Official Windows installer, ArrayFire v3.10.0 (build 492718b).
- Backend: oneAPI only. The same binary on the same GPU gives correct results with the OpenCL backend and the CPU backend; CUDA / OpenCL / CPU on an NVIDIA machine are also correct.
af::lookup(slice, idx), indexing the slice with aseq, and indexing acopy()of the slice are all correct; onlyslice(idx_array)(andaf::flat(slice)(idx_array)) are wrong.- Reproducible every run.
- Workaround: use
af::lookup(slice, idx)orslice.copy()(idx). - Expected:
view(idx)equalsaf::lookup(view, idx), as on the other backends.
Found while training word2vec on the device: each mini-batch is a slice of the epoch's examples, and picking rows from it this way updated the wrong rows on oneAPI (the loss rose instead of falling).
Related: #3732 (another oneAPI indexing issue, indexed min / max along dim 1).
Reproducible Code and/or Steps
#include <arrayfire.h>
int main() {
af::setBackend(AF_BACKEND_ONEAPI);
af::info();
const af::array data = af::range(af::dim4(100), 0, f32); // 0 .. 99
const af::array view = data(af::seq(10, 29)); // 10 .. 29
const unsigned i[4] = {0, 1, 2, 3};
const af::array idx(4, i);
af_print(view(idx)); // oneAPI: 0 1 2 3 expected: 10 11 12 13
af_print(af::lookup(view, idx)); // 10 11 12 13 on every backend
return 0;
}Output of a fuller probe on oneAPI device 0 (the same binary prints all checks ok with opencl and cpu on that machine):
ArrayFire v3.10.0 (oneAPI, 64-bit Windows, build 492718b5a)
[0] Intel(R) OpenCL Graphics: Intel(R) Iris(R) Xe Graphics, 7129 MB (fp16 )
expected: 10 11 12 13
view(idx) WRONG got 0 1 2 3
flat(view)(idx) WRONG got 0 1 2 3
lookup(view, idx) ok got 10 11 12 13
view(seq(0, 3)) ok got 10 11 12 13
some checks WRONG
System Information
- ArrayFire v3.10.0 (build 492718b), official Windows installer.
- Intel Core i5-1135G7 with Intel Iris Xe Graphics, driver 32.0.101.7088 (2026-06-17). Windows 11 Pro Education, build 26300.
af::info():
ArrayFire v3.10.0 (oneAPI, 64-bit Windows, build 492718b5a)
[0] Intel(R) OpenCL Graphics: Intel(R) Iris(R) Xe Graphics, 7129 MB (fp16 )
-1- Intel(R) OpenCL: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz, 16126 MB (fp64 fp16 )
Metadata
Metadata
Assignees
Labels
No labels
Activity
docs: oneAPI slice indexing filed as arrayfire/arrayfire#3733