[PATCH] D146715: [NVPTX] Enforce half type support is present for builtins

Jakub Chlanda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 04:35:01 PDT 2023


jchlanda added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:18912
+  case NVPTX::BI__nvvm_ldu_h2: {
+    return MakeHalfType(BuiltinID, E, *this);
+  }
----------------
tra wrote:
> We seem to be checking builtin IDs twice. Once here and then in MakeHalfType where we need to map them to intrinsics.
> I think the approach used for atomics above would work better here, too -- just pass appropriate Intrinsic as a parameter to MakeHalfType and remove the switch there.
> 
> Another option you may consider is that if the availability is only dependent on PTX or SM version, then we may get by with declaring the builtins as TARGET_BUILTIN with appropriate constraints and let the standard enforcement machinery to handle diags.
I've refactored those switches and passed intrinsic ID to `MakeHalfType` helper.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146715/new/

https://reviews.llvm.org/D146715



More information about the cfe-commits mailing list