On Tue, Feb 13, 2024 at 06:31:02PM +0100, Tobias Burnus wrote:
>       PR middle-end/113904
> 
> gcc/c/ChangeLog:
> 
>       * c-parser.cc (c_parser_omp_context_selector): Handle splitting of
>       OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR.
> 
> gcc/cp/ChangeLog:
> 
>       * parser.cc (cp_parser_omp_context_selector): Handle splitting of
>       OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR.
> 
> gcc/fortran/ChangeLog:
> 
>       * openmp.cc (gfc_match_omp_context_selector):
>       * trans-openmp.cc (gfc_trans_omp_declare_variant): Handle splitting of
>       OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR.
> 
> 
> gcc/ChangeLog:
> 
>       * omp-general.cc (struct omp_ts_info): Update for splitting of
>       OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTYDEV_NUM,BOOL}_EXPR.

_{ missing above before DEV_NUM

>       * omp-selectors.h (enum omp_tp_type): Replace
>       OMP_TRAIT_PROPERTY_EXPR by OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gfortran.dg/gomp/declare-variant-1.f90: Change 'condition' trait's
>       argument from integer to a logical expression.
>       * gfortran.dg/gomp/declare-variant-11.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-12.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-13.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-2.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-2a.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-3.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-4.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-6.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-8.f90: Likewise.
>       * gfortran.dg/gomp/declare-variant-20.f90: New test.

Otherwise LGTM.

Of course it makes me wonder to what extent we actually do support the
OpenMP 5.1 target_device device_num trait with constant or non-constant
device num, because similarly to the user condition trait if it something
that can't be decided at compile time but needs to be checked at runtime,
we need to be able to compute scores of all the variants that could be
effective depending on the device_num comparison and/or condition
evaluation and turn that into set of runtime comparisons with choices of
the variants depending on the scores.
If one is lucky, it can be device == device_num ? fn1 : fn2, but it can
be more complex than that.

        Jakub

Reply via email to