Skip to content

Fix __cuda_array_interface__ for HIP - #4458

Merged
mergify[bot] merged 3 commits into
cupy:masterfrom
emcastillo:fix-cuda-array
Dec 18, 2020
Merged

mergify[bot] merged 3 commits into
cupy:masterfrom
emcastillo:fix-cuda-array

Conversation

@emcastillo

@emcastillo emcastillo commented Dec 18, 2020 •

Copy link
Copy Markdown
Member

We were passing 1, or 2 to the cuda stream synchronize and this is not yet supported in HIP

@emcastillo emcastillo added the cat:bug Bugs label Dec 18, 2020
@emcastillo
emcastillo requested a review from leofang December 18, 2020 02:44
@kmaehashi kmaehashi self-assigned this Dec 18, 2020
@kmaehashi

kmaehashi commented Dec 18, 2020 •

Copy link
Copy Markdown
Member

I wonder if we have to expect ROCm pointers passed via __cuda_array_interface__ (it can be "This CuPy is built for HIP" error instead?), but anyway I think this fix makes sense.

I locally confirmed sync with the null pointer stream is ok.

# under ROCm:
cupy.cuda.ExternalStream(0).synchronize()  # -> ok
cupy.cuda.ExternalStream(1).synchronize()  # -> segfault
cupy.cuda.ExternalStream(2).synchronize()  # -> segfault

pfnCI, test this please.

@kmaehashi kmaehashi added the st:test-and-merge (deprecated) Ready to merge after test pass. label Dec 18, 2020
@kmaehashi kmaehashi changed the title fix array interface for hip Fix __cuda_array_interface__ for HIP Dec 18, 2020
@chainer-ci

Copy link
Copy Markdown
Member

Jenkins CI test (for commit d6e435d, target branch master) succeeded!

@mergify
mergify Bot merged commit 73f74b1 into cupy:master Dec 18, 2020
@kmaehashi kmaehashi added this to the v9.0.0b1 milestone Dec 18, 2020
@leofang

leofang commented Dec 18, 2020

Copy link
Copy Markdown
Member

Ah...I feel like I've seen this issue somewhere. Thanks for catching it!

@leofang

leofang commented Dec 18, 2020

Copy link
Copy Markdown
Member

@kmaehashi @emcastillo On a second thought, perhaps we should skip all CUDA Array Interface related tests on HIP, as there's no guarantee that it should work at all. There's a stalling discussion on generalizing CUDA Array Interface to HIP (numba/numba#4566), but since Numba does not support ROCm 3.x (numba/numba#6196) I think it'd take quite some time to sort everything out...

@kmaehashi

Copy link
Copy Markdown
Member

@leofang Thanks for the pointers! I talked with @emcastillo and thinking it's better to raise an error when __cuda_array_interface__ is used in CuPy built for HIP and skip tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:bug Bugs prio:high st:test-and-merge (deprecated) Ready to merge after test pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants