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

Jakub Chlanda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 02:37:31 PDT 2023


jchlanda marked an inline comment as done.
jchlanda added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:18313
     // of its member: n*alignof(t)."
-    return MakeLdgLdu(Intrinsic::nvvm_ldg_global_i);
-  case NVPTX::BI__nvvm_ldg_h:
-  case NVPTX::BI__nvvm_ldg_h2:
-    if (!HasHalfSupport(BuiltinID)) {
-      CGM.Error(E->getExprLoc(),
-                getContext().BuiltinInfo.getName(BuiltinID).str() +
-                    " requires native half type support.");
-      return nullptr;
-    }
-    [[fallthrough]];
+    return MakeLdgLdu(Intrinsic::nvvm_ldg_global_i, *this, E);
   case NVPTX::BI__nvvm_ldg_f:
----------------
tra wrote:
> This is where lambda would have some advantage as we could capture what it needs without having to pass 'this' or 'E' explicitly.
> In this case it's not too bad, so I'm fine either way, with a very slight bias towards lambdas. The static functions just don't seem to buy us anything here, IMO.
My reasoning was that it keeps `CodeGenFunction::EmitNVPTXBuiltinExpr` clean, all that it does now is to dispatch to a correct handler based on the builtin id (with exception of `mma`s); you are right though, it does it at the price of making the signatures more verbose.


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

https://reviews.llvm.org/D146715



More information about the cfe-commits mailing list