Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG] Very simple snippet not working on OpenCL, about af::range, af::dim4 and af::where

Open
#3,414 2 comments 0 reactions 1 assignee View on GitHub

@umar456 is already working on this.

Since May 17, 2023.

Assessment

This issue has not been assessed yet.

Description

bug

Hi,

This very simple snippet is working on the CPU backend, but not on the OpenCL backend.

af::setBackend(AF_BACKEND_OPENCL);
af::setDevice(0);
af::info(); std::cout << std::endl;

af::array arrayA = af::range(af::dim4(101, 101, 101), 2, s32);
af::array tmpA = af::where(arrayA == 0);
std::cout << tmpA.dims(0) << std::endl;

af::array arrayB = af::range(af::dim4(141, 141, 141), 2, s32);
af::array tmpB = af::where(arrayB == 0);
std::cout << tmpB.dims(0) << std::endl;

I tried on version AF_3.7.3 as well as AF_3.8.3 and AF_3.8.2. None are working correctly on OpenCL. Indeed, on the CPU the answer of tmpB.dims(0) is 19881, but is 0 on OpenCL. The array tmpB, should not be empty.

The problem only appears when the size of the arrayB is getting bigger as arrayA does not cause any issues.

Let me know if you can't reproduce on your end and I could submit more details.

Dominant language
C++
Stars
4.9k
Forks
555
Avg merge
1h 24m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from arrayfire/arrayfire

All issues in arrayfire/arrayfire

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.