Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG, CUDA backend] af::shift cannot shift an array with one row #3532

Closed
FloopCZ opened this issue Feb 11, 2024 · 4 comments
Closed

[BUG, CUDA backend] af::shift cannot shift an array with one row #3532

FloopCZ opened this issue Feb 11, 2024 · 4 comments
Assignees
Labels

Comments

@FloopCZ
Copy link
Contributor

FloopCZ commented Feb 11, 2024

af::shift produces invalid result (a single repeating value) when shifting an array made of a single row on CUDA backend. On CPU backend, it works correctly.

#include <arrayfire.h>

int main() {
    af::info();

    af::array A = af::randu(1, 10);
    af::print("A", A);

    af::array A_shifted = af::shift(A, 0, 1);
    af::print("A shifted", A_shifted);

    A_shifted = af::shift(A, 1, 0);
    af::print("A shifted", A_shifted);
}

Compile and run:

$ g++ -lafcuda bug.cpp && ./a.out

Output:

ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 12.0, Driver: 545.29.06
[0] NVIDIA RTX A500 Laptop GPU, 3905 MB, CUDA Compute 8.6
A
[1 10 1 1]
   Offset: 0
   Strides: [1 1 10 10]
    0.6010     0.0278     0.9806     0.2126     0.0655     0.5497     0.2864     0.3410     0.7509     0.4105
A shifted
[1 10 1 1]
   Offset: 0
   Strides: [1 1 10 10]
    0.4105     0.4105     0.4105     0.4105     0.4105     0.4105     0.4105     0.4105     0.4105     0.4105
A shifted
[1 10 1 1]
   Offset: 0
   Strides: [1 1 10 10]
    0.6010     0.6010     0.6010     0.6010     0.6010     0.6010     0.6010     0.6010     0.6010     0.6010

System:

Linux pine 6.7.2-arch1-2 #1 SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 09:22:15 +0000 x86_64 GNU/Linux
ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 12.0, Driver: 545.29.06
NVIDIA RTX A500 Laptop GPU, 3905 MB, CUDA Compute 8.6
@willyborn
Copy link
Contributor

willyborn commented Feb 13, 2024 via email

@FloopCZ
Copy link
Contributor Author

FloopCZ commented Feb 13, 2024

Nice catch, that was a tricky one, thanks! Let's hope the PR will get a review from one of the maintainers soon.

@willyborn
Copy link
Contributor

willyborn commented Feb 20, 2024 via email

@FloopCZ
Copy link
Contributor Author

FloopCZ commented Mar 7, 2024

Seems to be fixed in 3.9.0 indeed, thanks for testing!

@FloopCZ FloopCZ closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants