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

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 23 10:10:35 PDT 2023


tra added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:18912
+  case NVPTX::BI__nvvm_ldu_h2: {
+    return MakeHalfType(BuiltinID, E, *this);
+  }
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146715



More information about the cfe-commits mailing list