This is an archive of the discontinued LLVM Phabricator instance.

HIP: Fix handling of denormal mode
ClosedPublic

Authored by arsenm on Apr 13 2020, 7:34 AM.

Details

Reviewers
yaxunl
tra
Summary

I didn't realize HIP was a distinct offloading kind, so the subtarget
was looking for -march, which isn't correct for HIP. We also have the
possibility of different denormal defaults in the case of multiple
offload targets, so we need to thread the JobAction through the target
hook.

Diff Detail

Event Timeline

arsenm created this revision.Apr 13 2020, 7:34 AM
yaxunl added inline comments.Apr 13 2020, 8:30 AM
clang/lib/Driver/ToolChains/AMDGPU.cpp
286

If there are multiple --cuda-gpu-arch, driver will create separate JobAction for launching separate clang -cc1 command for each arch. This function is called for each JobAction and getOffloadingArch contains the single arch. Therefore there is no issue for multiple --cuda-gpu-arch and this comment can be removed.

clang/test/Driver/cuda-flush-denormals-to-zero.cu
27

this will result in multiple clang -cc1 commands, each one corresponding to an arch. You need to check each arch.

arsenm marked an inline comment as done.Apr 13 2020, 9:50 AM
arsenm added inline comments.
clang/test/Driver/cuda-flush-denormals-to-zero.cu
27

Since the flag is not printed for the default case, having a second arch check line would interfere with the -NOT check, as there is no CHECK-SAME-NOT

arsenm updated this revision to Diff 257011.Apr 13 2020, 9:51 AM

Remove leftover comment from before I used JobAction

tra added a comment.Apr 13 2020, 10:28 AM

LGTM. The patch appears to be an NFC one for CUDA.

yaxunl accepted this revision.Apr 13 2020, 10:51 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Apr 13 2020, 10:51 AM
In D78019#1978216, @tra wrote:

LGTM. The patch appears to be an NFC one for CUDA.

CUDA currently isn't changing the default FTZ mode based on the subtarget, which differs from nvcc according to the documentation