← 返回首页
Fix empty array to host copy seg fault by 9prady9 · Pull Request #3059 · arrayfire/arrayfire · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Fix empty array to host copy seg fault#3059

Merged
9prady9 merged 2 commits into
arrayfire:masterfrom
9prady9:issue3058
Jan 22, 2021
Merged

Fix empty array to host copy seg fault#3059
9prady9 merged 2 commits into
arrayfire:masterfrom
9prady9:issue3058

Conversation

Copy link
Copy Markdown
Member

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 added this to the 3.8.1 milestone Dec 8, 2020
9prady9 requested a review from umar456 December 8, 2020 08:08
Copy link
Copy Markdown
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 merged commit d86edd1 into arrayfire:master Jan 22, 2021
9prady9 deleted the issue3058 branch January 22, 2021 15:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Footer

© 2026 GitHub, Inc.