r270962 - [OPENMP] Fixed processing of '-fopenmp-version=' option and test.

Hal Finkel via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 2 17:22:02 PDT 2017


On 10/02/2017 07:08 PM, Alexey Bataev wrote:
> Hi Hal,
> As soon as we get the support for 4.5, including offloading. Otherwise 
> there always are going to be some people blaming the compiler for not 
> supporting 4.5 in full. Will try to support it ASAP.
> Meanwhile, you can use -fopenmp-version=45 option to force to 4.5

Thanks!

Do we have a status page anywhere that shows where we stand on the 
various features? Are there still features that we don't parse, or where 
we don't generate something that conservatively correct (e.g., as with 
"declare simd")?

  -Hal

>
> Best regards,
> Alexey Bataev
>
> 2 окт. 2017 г., в 19:53, Hal Finkel <hfinkel at anl.gov 
> <mailto:hfinkel at anl.gov>> написал(а):
>
>> Hi, Alexey,
>>
>> At what point can we switch, by default, to reporting a version for 
>> _OPENMP corresponding to 4.x? We're missing out on some OpenMP simd 
>> directives because the source code guards them with '#if _OPENMP >= 
>> 201307' or similar.
>>
>> Thanks again,
>> Hal
>>
>> On 05/26/2016 11:13 PM, Alexey Bataev via cfe-commits wrote:
>>> Author: abataev
>>> Date: Thu May 26 23:13:39 2016
>>> New Revision: 270962
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=270962&view=rev
>>> Log:
>>> [OPENMP] Fixed processing of '-fopenmp-version=' option and test.
>>>
>>> Modified:
>>>     cfe/trunk/lib/Driver/Tools.cpp
>>>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>>>     cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>>>     cfe/trunk/test/OpenMP/driver.c
>>>
>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270962&r1=270961&r2=270962&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 23:13:39 2016
>>> @@ -4864,7 +4864,6 @@ void Clang::ConstructJob(Compilation &C,
>>>    // Forward flags for OpenMP
>>>    if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
>>>                     options::OPT_fno_openmp, false)) {
>>> -    Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
>>>      switch (getOpenMPRuntime(getToolChain(), Args)) {
>>>      case OMPRT_OMP:
>>>      case OMPRT_IOMP5:
>>> @@ -4877,6 +4876,7 @@ void Clang::ConstructJob(Compilation &C,
>>>        if (!Args.hasFlag(options::OPT_fopenmp_use_tls,
>>>                          options::OPT_fnoopenmp_use_tls, 
>>> /*Default=*/true))
>>>          CmdArgs.push_back("-fnoopenmp-use-tls");
>>> +      Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
>>>        break;
>>>      default:
>>>        // By default, if Clang doesn't know how to generate useful 
>>> OpenMP code
>>>
>>> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270962&r1=270961&r2=270962&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
>>> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 26 
>>> 23:13:39 2016
>>> @@ -1954,15 +1954,16 @@ static void ParseLangArgs(LangOptions &O
>>>    }
>>>      // Check if -fopenmp is specified.
>>> -  Opts.OpenMP = Args.hasArg(options::OPT_fopenmp);
>>> +  Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 1 : 0;
>>>    Opts.OpenMPUseTLS =
>>>        Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
>>>    Opts.OpenMPIsDevice =
>>>        Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device);
>>>      if (Opts.OpenMP) {
>>> -    if (int Version = getLastArgIntValue(Args, OPT_fopenmp_version_EQ,
>>> -                                         Opts.OpenMP, Diags))
>>> +    int Version =
>>> +        getLastArgIntValue(Args, OPT_fopenmp_version_EQ, 
>>> Opts.OpenMP, Diags);
>>> +    if (Version != 0)
>>>        Opts.OpenMP = Version;
>>>      // Provide diagnostic when a given target is not expected to be 
>>> an OpenMP
>>>      // device or host.
>>>
>>> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=270962&r1=270961&r2=270962&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
>>> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Thu May 26 23:13:39 2016
>>> @@ -922,24 +922,24 @@ static void InitializePredefinedMacros(c
>>>    }
>>>      // OpenMP definition
>>> -  if (LangOpts.OpenMP) {
>>> -    // OpenMP 2.2:
>>> -    //   In implementations that support a preprocessor, the _OPENMP
>>> -    //   macro name is defined to have the decimal value yyyymm where
>>> -    //   yyyy and mm are the year and the month designations of the
>>> -    //   version of the OpenMP API that the implementation support.
>>> -    switch (LangOpts.OpenMP) {
>>> -    case 40:
>>> -      Builder.defineMacro("_OPENMP", "201307");
>>> -      break;
>>> -    case 45:
>>> -      Builder.defineMacro("_OPENMP", "201511");
>>> -      break;
>>> -    default:
>>> -      // Default version is OpenMP 3.1
>>> -      Builder.defineMacro("_OPENMP", "201107");
>>> -      break;
>>> -    }
>>> +  // OpenMP 2.2:
>>> +  //   In implementations that support a preprocessor, the _OPENMP
>>> +  //   macro name is defined to have the decimal value yyyymm where
>>> +  //   yyyy and mm are the year and the month designations of the
>>> +  //   version of the OpenMP API that the implementation support.
>>> +  switch (LangOpts.OpenMP) {
>>> +  case 0:
>>> +    break;
>>> +  case 40:
>>> +    Builder.defineMacro("_OPENMP", "201307");
>>> +    break;
>>> +  case 45:
>>> +    Builder.defineMacro("_OPENMP", "201511");
>>> +    break;
>>> +  default:
>>> +    // Default version is OpenMP 3.1
>>> +    Builder.defineMacro("_OPENMP", "201107");
>>> +    break;
>>>    }
>>>      // CUDA device path compilaton
>>>
>>> Modified: cfe/trunk/test/OpenMP/driver.c
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/driver.c?rev=270962&r1=270961&r2=270962&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/OpenMP/driver.c (original)
>>> +++ cfe/trunk/test/OpenMP/driver.c Thu May 26 23:13:39 2016
>>> @@ -8,17 +8,17 @@
>>>  // CHECK-NO-TLS: -cc1
>>>  // CHECK-NO-TLS-SAME: -fnoopenmp-use-tls
>>>  //
>>> -// RUN: %clang %s -c -E -dM -fopenmp | FileCheck 
>>> --check-prefix=CHECK-DEFAULT-VERSION %s
>>> -// RUN: %clang %s -c -E -dM -fopenmp -fopenmp-version=1 | FileCheck 
>>> --check-prefix=CHECK-DEFAULT-VERSION %s
>>> -// RUN: %clang %s -c -E -dM -fopenmp -fopenmp-version=0 | FileCheck 
>>> --check-prefix=CHECK-DEFAULT-VERSION %s
>>> -// RUN: %clang %s -c -E -dM -fopenmp -fopenmp-version=100 | 
>>> FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
>>> -// RUN: %clang %s -c -E -dM -fopenmp -fopenmp-version=31 | 
>>> FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
>>> +// RUN: %clang %s -c -E -dM -fopenmp=libomp | FileCheck 
>>> --check-prefix=CHECK-DEFAULT-VERSION %s
>>> +// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=1 | 
>>> FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
>>> +// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=0 | 
>>> FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
>>> +// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=100 | 
>>> FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
>>> +// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=31 | 
>>> FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
>>>  // CHECK-DEFAULT-VERSION: #define _OPENMP 201107
>>>  -// RUN: %clang %s -c -E -dM -fopenmp -fopenmp-version=40 | 
>>> FileCheck --check-prefix=CHECK-40-VERSION %s
>>> +// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=40 | 
>>> FileCheck --check-prefix=CHECK-40-VERSION %s
>>>  // CHECK-40-VERSION: #define _OPENMP 201307
>>>  -// RUN: %clang %s -c -E -dM -fopenmp -fopenmp-version=45 | 
>>> FileCheck --check-prefix=CHECK-45-VERSION %s
>>> +// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=45 | 
>>> FileCheck --check-prefix=CHECK-45-VERSION %s
>>>  // CHECK-45-VERSION: #define _OPENMP 201511
>>>    // RUN: %clang %s -c -E -dM -fopenmp-version=1 | FileCheck 
>>> --check-prefix=CHECK-VERSION %s
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>> -- 
>> Hal Finkel
>> Lead, Compiler Technology and Programming Languages
>> Leadership Computing Facility
>> Argonne National Laboratory
>>

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171002/f88a1514/attachment-0001.html>


More information about the cfe-commits mailing list