[Openmp-dev] long double in AST

Johannes Doerfert via Openmp-dev openmp-dev at lists.llvm.org
Thu Apr 16 16:16:35 PDT 2020


Hi George,

Because the target might not support them but we need the size anyway.
The reasons is unavailable types in a structure which is mapped. While
we could bail, the user might have a hard time breaking the structure
apart. Instead, we allow it as long as you don't interact with the type
as such. You basically have an array of bytes on the device side, not
a thing with an unavailable type. Does this make sense?

You should also take a look at this conversation: 
https://reviews.llvm.org/D74387

I explained my preferred solution, and he shortcomings of the OpenMP 
implementation so far.

FWIW, I was hoping Intel would now implement this for SYCL and OpenMP in 
the same way :)


WDYT?

Cheers,

   Johannes




On 4/16/20 5:42 PM, Rokos, Georgios via Openmp-dev wrote:
 > Hi all,
 >
 > I was looking at the following function from 
clang/lib/AST/ASTContext.cpp:1649
 >
 > /// getFloatTypeSemantics - Return the APFloat 'semantics' for the 
specified
 > /// scalar floating point type.
 > const llvm::fltSemantics &ASTContext::getFloatTypeSemantics(QualType 
T) const {
 >   switch (T->castAs<BuiltinType>()->getKind()) {
 >   default:
 >     llvm_unreachable("Not a floating point type!");
 >   case BuiltinType::Float16:
 >   case BuiltinType::Half:
 >     return Target->getHalfFormat();
 >   case BuiltinType::Float:      return Target->getFloatFormat();
 >   case BuiltinType::Double:     return Target->getDoubleFormat();
 >   case BuiltinType::LongDouble:
 >     if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice)
 >       return AuxTarget->getLongDoubleFormat();
 >     return Target->getLongDoubleFormat();
 >   case BuiltinType::Float128:
 >     if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice)
 >       return AuxTarget->getFloat128Format();
 >     return Target->getFloat128Format();
 >   }
 > }
 >
 > For long double and float128, when we are on the device we get the 
"semantics" for those datatypes from AuxTarget instead of Target. Why is 
that?
 >
 > Thanks!
 > George
 >
 >
 >
 > _______________________________________________
 > Openmp-dev mailing list
 > Openmp-dev at lists.llvm.org
 > https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev



More information about the Openmp-dev mailing list