This is an archive of the discontinued LLVM Phabricator instance.

[CUDA][SPIRV] Assign global address space to CUDA kernel arguments
ClosedPublic

Authored by shangwuyao on Feb 22 2022, 4:15 PM.

Details

Summary

(resubmit https://reviews.llvm.org/D119207 after fixing the test for some build settings)
This patch converts CUDA pointer kernel arguments with default address space to
CrossWorkGroup address space (__global in OpenCL). This is because Generic or
Function (OpenCL's private) is not supported as storage class for kernel pointer types.

Diff Detail

Event Timeline

shangwuyao created this revision.Feb 22 2022, 4:15 PM
shangwuyao requested review of this revision.Feb 22 2022, 4:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2022, 4:15 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
shangwuyao edited the summary of this revision. (Show Details)Feb 22 2022, 4:17 PM
shangwuyao added a comment.EditedFeb 22 2022, 10:04 PM

Looking into the (new) test failure on Windows, since the change has already been reviewed, will try to commit after resolving the test failure.

Disabled a hip test on Windows that's breaking on head.

  • What's different in this patch vs the previous one?
  • *Disabled a hip test on Windows that's breaking on head.* Can you clarify: Is this test broken at HEAD, or does it break with your patch?

    If it's broken at HEAD, then it should be disabled in a separate patch.

    If it breaks with your patch, can you explain why it should be disabled rather than fixed?
  • What's different in this patch vs the previous one?

Previous patch broke at two different post-commit build configurations. The generated SPIR-V are:

define hidden spir_kernel void @_Z6kernelPi(i32 addrspace(1)* noundef %output.coerce) #0 {
define spir_kernel void @_Z6kernelPi(i32 addrspace(1)* noundef %0) #0 {

And the original test:

// CHECK: define spir_kernel void @_Z6kernelPi(i32 addrspace(1)* noundef %output.coerce)

Changed that to below so that it could handle those two build configurations correctly.

// CHECK: define
// CHECK-SAME: spir_kernel void @_Z6kernelPi(i32 addrspace(1)* noundef

(The previous reverted patch could have been reopened so that the change is more clear, but didn't know such option exist until recently.)

  • *Disabled a hip test on Windows that's breaking on head.* Can you clarify: Is this test broken at HEAD, or does it break with your patch?

    If it's broken at HEAD, then it should be disabled in a separate patch.

    If it breaks with your patch, can you explain why it should be disabled rather than fixed?

It is broken at HEAD, will add another patch.

Disabling the test failing at HEAD with a separate patch.

@yaxunl I saw that you added the test recently, could you provide some context? I think this test is broken at HEAD as I saw it is broken for other patches (see this build) as well.

jlebar accepted this revision.Feb 24 2022, 8:49 PM

I'll land this for you.

This revision is now accepted and ready to land.Feb 24 2022, 8:49 PM
This revision was landed with ongoing or failed builds.Feb 24 2022, 8:52 PM
This revision was automatically updated to reflect the committed changes.

@yaxunl I saw that you added the test recently, could you provide some context? I think this test is broken at HEAD as I saw it is broken for other patches (see this build) as well.

which test?

@yaxunl I saw that you added the test recently, could you provide some context? I think this test is broken at HEAD as I saw it is broken for other patches (see this build) as well.

which test?

OK. I saw it. Thanks for handling it. I will fix it.