clang/OpenCL: Apply default attributes to enqueued blocks
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 12 Jan 2023 15:07:18 +0000 (10:07 -0500)
committerMatt Arsenault <arsenm2@gmail.com>
Mon, 30 Jan 2023 19:03:15 +0000 (15:03 -0400)
commit647925648a0fde06b5b44086843f0d8f164a71df
treeba6ff5dbe5284c125371c97069ee1ed2fbf30631
parentd12ee4bf7c14a00b14890fc3042edd659dde7fb2
clang/OpenCL: Apply default attributes to enqueued blocks

This was missing important environment context, like denormal-fp-math
and target-features. Curiously this seems to be losing nounwind. Note
this only fixes the actual invoke kernel. The invoke function is
already setting the default attribute set for internal
functions. However that is still buggy since it's not applying any use
function attributes (it's also missing uniform-work-group-size).

There seem to be too many different functions for setting attributes
with inconsistent behavior. The Function overload of
addDefaultFunctionAttributes seems to miss the target-cpu and
target-features. The AttrBuilder one seems to miss optnone (but that
seems to be disallowed on blocks anyway). Neither one calls
setTargetAttributes, when it probably should. uniform-work-group-size
is also set through AMDGPU code when it should be emitting generically
as a language property.

I also noticed update_cc_test_checks for attributes seem to not
connect the captured attribute variables to the attributes at the end
(although I think the numbers happen to work out correctly).
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
clang/test/CodeGenOpenCL/cl20-device-side-enqueue-attributes.cl [new file with mode: 0644]
clang/test/CodeGenOpenCL/cl20-device-side-enqueue.cl