This is an archive of the discontinued LLVM Phabricator instance.

clang/AMDGPU: Assume denormals are enabled for the default target.
ClosedPublic

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

Details

Summary

Since the default logic was based on having fast denormal/fma
features, and the default target has no features, we assumed flushing by
default. This fixes incorrectly assuming flushing in builds for
"generic" IR libraries.

The handling for no specified --cuda-gpu-arch in HIP is kind of
broken. Somewhere else forces a default target of gfx803, which does
not enable denormal handling by default. We don't see this default
switching here, so you'll end up with a different denormal mode
depending on whether you explicitly requested gfx803, or used it by
default.

Diff Detail

Event Timeline

arsenm created this revision.Apr 13 2020, 7:55 AM

I think https://reviews.llvm.org/D78019 should fix the issue about HIP not using correct default denormal value if no arch is specified.

In that case, driver actually sets offloading arch to gfx803 and clang should be able to see it in JobAction.

I think https://reviews.llvm.org/D78019 should fix the issue about HIP not using correct default denormal value if no arch is specified.

In that case, driver actually sets offloading arch to gfx803 and clang should be able to see it in JobAction.

It doesn't, that patch is the parent of this one. This use an empty offloading arch and I wasn't sure where the codegen default was forced

arsenm updated this revision to Diff 257318.Apr 14 2020, 7:22 AM

Fix test

I think https://reviews.llvm.org/D78019 should fix the issue about HIP not using correct default denormal value if no arch is specified.

In that case, driver actually sets offloading arch to gfx803 and clang should be able to see it in JobAction.

I just tried again and you're right, the function does see the explicit GK_GFX803

yaxunl added inline comments.Apr 14 2020, 7:40 AM
clang/test/Driver/cuda-flush-denormals-to-zero.cu
26

this comment can be removed or modified

arsenm updated this revision to Diff 257676.Apr 15 2020, 5:00 AM

Fix comment

yaxunl accepted this revision.Apr 15 2020, 5:42 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Apr 15 2020, 5:42 AM