This is an archive of the discontinued LLVM Phabricator instance.

[CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes
ClosedPublic

Authored by yaxunl on Jun 8 2018, 1:19 PM.

Details

Summary

There are HIP applications e.g. Tensorflow 1.3 using amdgpu kernel attributes, however
currently they are only allowed on OpenCL kernel functions.

This patch will allow amdgpu kernel attributes to be applied to CUDA/HIP __global__
functions.

Diff Detail

Repository
rL LLVM

Event Timeline

yaxunl created this revision.Jun 8 2018, 1:19 PM
tra added a subscriber: tra.Jun 8 2018, 1:59 PM

Drive-by review:

The patch could use a better description.
Something that describes *what* the patch does (E.g. enforce that attributes X/Y/Z are only applied to global functions.)
*why* the change is needed is relevant, too, but it's not very useful without the *what* part.

test/SemaCUDA/amdgpu-attrs.cu
66–69 ↗(On Diff #150558)

This is confusing. Isn't kernel == __global__ function?

Considering that the error message is diag::err_opencl_kernel_attr, I think the diagnostics should say applied to a OpenCL kernel function

yaxunl retitled this revision from [CUDA][HIP] Allow CUDA kernel to have amdgpu kernel attributes to [CUDA][HIP] Allow CUDA `__global__` functions to have amdgpu kernel attributes.Jun 8 2018, 2:06 PM
yaxunl edited the summary of this revision. (Show Details)
yaxunl marked an inline comment as done.Jun 8 2018, 2:07 PM
In D47958#1126875, @tra wrote:

Drive-by review:

The patch could use a better description.
Something that describes *what* the patch does (E.g. enforce that attributes X/Y/Z are only applied to global functions.)
*why* the change is needed is relevant, too, but it's not very useful without the *what* part.

Thanks for your suggestion. Modified the description.

test/SemaCUDA/amdgpu-attrs.cu
66–69 ↗(On Diff #150558)

Thanks for the suggestion. Will do.

yaxunl updated this revision to Diff 150872.Jun 11 2018, 5:53 PM
yaxunl marked 2 inline comments as done.
yaxunl retitled this revision from [CUDA][HIP] Allow CUDA `__global__` functions to have amdgpu kernel attributes to [CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes.

Improve error msg.

tra accepted this revision.Jun 12 2018, 10:34 AM

Thank you.

This revision is now accepted and ready to land.Jun 12 2018, 10:34 AM
This revision was automatically updated to reflect the committed changes.