Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

[BUG] oneAPI: indexing a slice with an index array ignores the slice's offset #3733

Open

Description

@code3hr

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 a seq, and indexing a copy() of the slice are all correct; only slice(idx_array) (and af::flat(slice)(idx_array)) are wrong.
  • Reproducible every run.
  • Workaround: use af::lookup(slice, idx) or slice.copy()(idx).
  • Expected: view(idx) equals af::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

  1. ArrayFire v3.10.0 (build 492718b), official Windows installer.
  2. Intel Core i5-1135G7 with Intel Iris Xe Graphics, driver 32.0.101.7088 (2026-06-17). Windows 11 Pro Education, build 26300.
  3. 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 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions