Skip to content

Commit 7f12dca

Browse files
committed
[HIP] Fix regression about __fp16 args and return value
HIP allows __fp16 as function arguments and return value by passing -fallow-half-arguments-and-returns to clang through hipcc. https://reviews.llvm.org/D133885 removed -fallow-half-arguments-and-returns and add a TargetInfo member to control it. This caused regressions in some HIP apps (ROCm/hip#3178). Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D145345 Fixes: ROCm/hip#3178
1 parent 0fb3ebb commit 7f12dca

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

clang/lib/Basic/Targets/AMDGPU.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple &Triple,
245245
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
246246
CUMode = !(GPUFeatures & llvm::AMDGPU::FEATURE_WGP);
247247
ReadOnlyFeatures.insert("image-insts");
248+
HalfArgsAndReturns = true;
248249
}
249250

250251
void AMDGPUTargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn-amd-amdhsa -fcuda-is-device -fsyntax-only -verify %s
2+
3+
// expected-no-diagnostics
4+
5+
__fp16 testFP16AsArgAndReturn(__fp16 x) {
6+
return x;
7+
}

0 commit comments

Comments
 (0)