Skip to content

Fix bug in getMappedPtr in OpenCL due to invalid lambda capture #3163

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

Merged
merged 2 commits into from
Jul 29, 2021

Conversation

umar456
Copy link
Member

@umar456 umar456 commented Jul 29, 2021

This commit fixes a bug that was caused by an invalid capture of
the Array class in the destructor of the mapped_ptr function. This
caused intermittent errors when using the getMappedPtr function.

Description

This commit fixes a bug in the getMappedPtr function of the OpenCL
Array class. The bug was caused because we were capturing the
Array class using the this pointer instead of specifically capturing
the Buffer_ptr object. These changes are necessary because the
clEnqueueUnmap function failed to execute for CPU backends and
causes segfaults in certain scenarios.

This PR can be backported to older versions.

Changes to Users

N/A

Checklist

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

umar456 added 2 commits July 29, 2021 14:12
This commit fixes a bug that was caused by an invalid capture of
the Array class in the destructor of the mapped_ptr function. This
caused intermittent errors when using the getMappedPtr function.
Fixes a bug in getMappedPtr where the Array object was not ready
and needed to be evaluated when the map function was called. This
appeared when the LHS or the RHS of the matmul function were
JIT nodes and were sparse Arrays.
@umar456 umar456 merged commit 3ff9b24 into arrayfire:master Jul 29, 2021
@umar456 umar456 deleted the map_bug branch July 29, 2021 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants