This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args
ClosedPublic

Authored by echuraev on Mar 24 2017, 3:04 AM.

Details

Summary

"kernel_arg_type_qual" metadata should contain const/volatile/restrict
tags only for pointer types to match the corresponding requirement of
the OpenCL specification.

OpenCL 2.0 spec 5.9.3 Kernel Object Queries:

CL_KERNEL_ARG_TYPE_VOLATILE is returned if the argument is a pointer
and the referenced type is declared with the volatile qualifier.
[...]
Similarly, CL_KERNEL_ARG_TYPE_CONST is returned if the argument is a
pointer and the referenced type is declared with the restrict or const
qualifier.
[...]
CL_KERNEL_ARG_TYPE_RESTRICT will be returned if the pointer type is
marked restrict.

Diff Detail

Event Timeline

echuraev created this revision.Mar 24 2017, 3:04 AM
Anastasia added inline comments.Mar 28 2017, 8:17 AM
test/CodeGenOpenCL/kernel-arg-info.cl
66

Could we modify the test to check that const and volatile are added for the pointers though?

echuraev updated this revision to Diff 93357.Mar 29 2017, 5:31 AM
echuraev marked an inline comment as done.
echuraev added inline comments.
test/CodeGenOpenCL/kernel-arg-info.cl
66

Added test case only for volatile pointer because const is checked in the Z argument of foo function.

Anastasia accepted this revision.Mar 30 2017, 10:32 AM

LGTM!

test/CodeGenOpenCL/kernel-arg-info.cl
66

I think it would still be nice to add an argument with explicit const because the current test doesn't have it explicitly.

This revision is now accepted and ready to land.Mar 30 2017, 10:32 AM
echuraev updated this revision to Diff 93596.Mar 31 2017, 12:18 AM
echuraev marked an inline comment as done.Mar 31 2017, 12:22 AM
echuraev closed this revision.Mar 31 2017, 3:27 AM