On Tue, Oct 29, 2019 at 05:40:11PM -0500, Segher Boessenkool wrote:
> On Tue, Oct 29, 2019 at 06:15:31PM +0100, Jakub Jelinek wrote:
> > The standard makes it implementation defined what an arch is and what is
> > isa, but I think because there is no selector like target that arch should
> > mostly contain identifiers that match the ABI incompatible stuff (target,
> > perhaps whether it is 32-bit or 64-bit, plus endianity where needed etc.)
> > and keep isa to be identifiers for the ISAs, or perhaps where there are no
> > clear ISA names say architecture variants or revisions or similar.
> > 
> > I've only implemented i386 and nvptx so far, will leave the rest to
> > port maintainers; would be nice to coordinate what is added a little bit
> > with other implementations like LLVM, if they'd be willing to coordinate.
> 
> What would this be used for?  Can you give some more context?

https://www.openmp.org/spec-html/5.0/openmpse11.html#x41-480002.3
OpenMP 5.0 has two directives, declare variant which I'm implementing right
now and metadirective, which I'll be working on next stage1.
declare variant is a direct call redirection based on context, where one can
provide a specialized function implementation for a particular OpenMP
construct, compiler implementation, CPU architecture, etc.
The metadirective allows specialization of OpenMP pragmas, use this OpenMP 
pragma
only in some OpenMP context and not in another one, or only on certain
architecture, isa, whatever.
These actually don't query anything at runtime, it is purely compile time
specialization, based on what either the whole translation unit or a
particular function are compiled for.

> There already are a lot of different ways to get information about the
> execution environment you're running on; why is this any better?

There is no question of better or worse, it is simply a part of a standard
that GCC is trying to implement, like we try to implement all of C++20, we
also try to implement all of OpenMP or OpenACC etc.
The exact identifiers are implementation defined though, and that is why we
need to think of what is reasonable for each target (at least each target
where OpenMP is used often, powerpc is certainly one of those).

        Jakub

Reply via email to