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: indexed af::max / af::min along dim 1 return wrong values and indices #3732

Open

Description

@code3hr

On the oneAPI backend, af::max(val, idx, in, 1) and af::min(val, idx, in, 1) (indexed reductions along dim 1) return wrong values and indices when the array has few rows: only part of each row is reduced.

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 with the CPU backend. CUDA / OpenCL / CPU on an NVIDIA machine are also correct.
  • Only the indexed form is affected. af::max(in, 1) (no indices) is correct, and the indexed call along dim 0 is correct.
  • Reproducible every run.
  • Workaround: transpose (or af::reorder) so the reduced dimension is dim 0, call af::max(val, idx, in, 0), and transpose back.
  • Expected: the same values and indices as af::max(val, idx, in.T(), 0) transposed back, as on the other backends.

Related but different: #3656 (wrong location for a subarray input, on CUDA/OpenCL/CPU). Here the input is a plain, contiguous array, and only oneAPI is affected.

Reproducible Code and/or Steps

#include <arrayfire.h>
#include <cstdio>

int main() {
    af::setBackend(AF_BACKEND_ONEAPI);
    af::info();
    // [3, 5], column-major. Row maxima are in columns 1, 3 and 4.
    const float v[15] = {0.0555f, 0.5535f, 0.2385f,
                         0.8969f, 0.3002f, 0.3137f,
                         0.0944f, 0.0550f, 0.0022f,
                         0.2531f, 0.7665f, 0.0864f,
                         0.3456f, 0.1136f, 0.9150f};
    af::array x(3, 5, v);
    af::array val, idx;
    af::max(val, idx, x, 1);
    af_print(val);
    af_print(idx);  // oneAPI: 1 0 1 (values 0.8969 0.5535 0.3137); expected 1 3 4 (0.8969 0.7665 0.9150)
    return 0;
}

A wider check (randn arrays, dim 1 compared with dim 0 of the transpose), oneAPI device 0:

shape max with indices min with indices max without indices
[3, 5] wrong wrong ok
[3, 4] ok wrong ok
[8, 5] ok ok ok
[37, 100] wrong wrong ok
[5, 1000] wrong wrong ok
[100, 37] ok ok ok
[2000, 200] ok ok ok

With opencl or cpu selected instead, every row is ok on the same machine.

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 )

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