[PATCH] D130096: [Clang][AMDGPU] Emit AMDGPU library control constants in clang
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 22 16:36:14 PDT 2022
yaxunl added inline comments.
================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:9436
+ CGM.getModule(), Type, true,
+ llvm::GlobalValue::LinkageTypes::LinkOnceODRLinkage,
+ llvm::ConstantInt::get(Type, Value), Name, nullptr,
----------------
This does not support per-TU control variables. Probably should use internal linkage.
================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1679-1682
+ if (Args.hasArg(OPT_fgpu_flush_denormals_to_zero))
+ Opts.AMDGPUDenormAtZero = true;
+ else if (Args.hasArg(OPT_fno_gpu_flush_denormals_to_zero))
+ Opts.AMDGPUDenormAtZero = false;
----------------
For OpenCL, it should be determined by options::OPT_cl_denorms_are_zero
================
Comment at: clang/test/CodeGen/amdgcn-control-constants.c:7
+// RUN: %clang_cc1 -x c -triple amdgcn-amd-amdhsa -target-cpu gfx908 -funsafe-math-optimizations -S -emit-llvm -o - %s | FileCheck %s --check-prefix=UNSAFE-MATH
+
+// GFX90A: @__oclc_daz_opt = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 0, align 1
----------------
need a test for -target-cpu gfx1030 -target-feature +wavefrontsize64 and check __oclc_wavefrontsize64 to be 1.
================
Comment at: clang/test/CodeGen/amdgcn-control-constants.c:8
+
+// GFX90A: @__oclc_daz_opt = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 0, align 1
+// GFX90A: @__oclc_wavefrontsize64 = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 1, align 1
----------------
need an OpenCL test for -cl-denorms-are-zero
================
Comment at: clang/test/CodeGen/amdgcn-control-constants.c:10
+// GFX90A: @__oclc_wavefrontsize64 = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 1, align 1
+// GFX90A: @__oclc_finite_only_opt = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 0, align 1
+// GFX90A: @__oclc_unsafe_math_opt = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 0, align 1
----------------
need OpenCL tests for -cl-finite-math-only and -cl-fast-relaxed-math
================
Comment at: clang/test/CodeGen/amdgcn-control-constants.c:11
+// GFX90A: @__oclc_finite_only_opt = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 0, align 1
+// GFX90A: @__oclc_unsafe_math_opt = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 0, align 1
+// GFX90A: @__oclc_correctly_rounded_sqrt32 = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 1, align 1
----------------
need OpenCL tests for -cl-unsafe-math-optimizations and -cl-fast-relaxed-math
================
Comment at: clang/test/CodeGen/amdgcn-control-constants.c:12
+// GFX90A: @__oclc_unsafe_math_opt = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 0, align 1
+// GFX90A: @__oclc_correctly_rounded_sqrt32 = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i8 1, align 1
+// GFX90A: @__oclc_ISA_version = linkonce_odr hidden local_unnamed_addr addrspace(4) constant i32 9010, align 4
----------------
need an OpenCL test for -cl-fp32-correctly-rounded-divide-sqrt. If it needs CodeGenOpt you may need to re-use the option for HIP.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130096/new/
https://reviews.llvm.org/D130096
More information about the cfe-commits
mailing list