FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed assignment with idx after changing device by willyborn · Pull Request #3420 · arrayfire/arrayfire · GitHub

Repository navigation

Fixed assignment with idx after changing device - #3420

Merged
umar456 merged 1 commit into
arrayfire:masterfrom
willyborn:assignMultiDevs
May 12, 2023
Merged

umar456 merged 1 commit into
arrayfire:masterfrom
willyborn:assignMultiDevs

Conversation

Copy link
Copy Markdown
Contributor

After changing device, the assignment with index generates an exception (Invalid Memory Object when calling clSetkernelArg)

Description

Code to reproduce:
#include <arrayfire.h>

int main(int, char**) {
// Initialize the kernel array just once
af::info();

const int idx[]{1, 3};

af::setDevice(0);
af::array d0_idx(2, idx, afHost);
af::array d0_in(10, 10);
d0_in(d0_idx) = 1.0;  					// success

af::setDevice(1);
af::array d1_idx(2, idx, afHost);
af::array d1_in(10, 10);
d1_in(d1_idx) = 2.0;  					// <- exception

}

Output:
ArrayFire v3.9.0 (OpenCL, 64-bit Windows, build b184388)
[0] AMD: Spectre, 6571 MB -- OpenCL 2.0 AMD-APP (3224.5) -- Device driver 3224.5 -- FP64 Support: True
-1- NVIDIA: NVIDIA GeForce GTX 750 Ti, 2047 MB -- OpenCL 3.0 CUDA -- Device driver 531.61 -- FP64 Support: True
OpenCL Error (-38): Invalid Memory Object when calling clSetKernelArg

Cause:
For Assignments on arrays with indexes, empty indexes are internally generated.
For each empty index, an empty device buffer is used as parameter to the assign kernel.
Since the empty device buffer remains unchanged, the resulting buffer of the 1st time is cached.
The cached device buffer is however dependent on the context, explaining why it failed after setdevice(1) (=changed context).

Changes to Users

1 bug less.

Checklist

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

umar456 merged commit 8e3d1fa into arrayfire:master May 12, 2023
willyborn deleted the assignMultiDevs branch May 15, 2023 18:17
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL