Skip to content

Conversation

@9prady9
Copy link
Member

@9prady9 9prady9 commented Dec 8, 2020

Description

Fixes: #3058

Changes to Users

Calls to copy empty array to host pointer won't seg-fault on OpenCL backend anymore.

Checklist

  • Rebased on latest master
  • Code compiles
  • Tests pass
  • [ ] Functions added to unified API
  • [ ] Functions documented

@9prady9 9prady9 added this to the 3.8.1 milestone Dec 8, 2020
@9prady9 9prady9 requested a review from umar456 December 8, 2020 08:08
@9prady9
Copy link
Member Author

9prady9 commented Jan 12, 2021

Unit test sample output
Success

[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Array
[ RUN      ] Array.EmptyArrayHostCopy
[       OK ] Array.EmptyArrayHostCopy (216 ms)
[----------] 1 test from Array (216 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (216 ms total)
[  PASSED  ] 1 test.

Failure

[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Array
[ RUN      ] Array.EmptyArrayHostCopy
../test/array.cpp:623: Failure
Death test: { af::array empty; std::vector<float> hdata(100); empty.host(hdata.data()); exit(0); }
    Result: died but not with expected exit code:
            Terminated by signal 11 (core dumped)
Actual msg:
[  DEATH   ] 
[  FAILED  ] Array.EmptyArrayHostCopy (2525 ms)
[----------] 1 test from Array (2525 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (2525 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Array.EmptyArrayHostCopy

Earlier to this change, CPU and CUDA backends are working fine although
doing unncessary work. OpenCL on the other hand is seg-faulting due to
cl::Buffer being nullptr doing the following:

cl::Buffer buf = *A.get(); // Calls retain/release on invalid object
@9prady9 9prady9 merged commit d86edd1 into arrayfire:master Jan 22, 2021
@9prady9 9prady9 deleted the issue3058 branch January 22, 2021 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Empty array behaves different in OpenCL vs CUDA

2 participants