Hi Sandra,

Tobias Burnus wrote:
(I have now an errant to do - and will continue later with the review.)

First, something a bit unrelated to this patch but affecting related code (quoting old, existing code):

int omp_context_selector_matches (tree ctx)
...
            case OMP_TRAIT_DEVICE_KIND:
if (set == OMP_TRAIT_SET_DEVICE) for (tree p = OMP_TS_PROPERTIES (ts); p; p = TREE_CHAIN (p))
                  {
                    const char *prop = omp_context_name_list_prop (p);
                    if (prop == NULL)
                      return 0;
                    if (!strcmp (prop, "any"))
                      continue;

[Cf. also comment to 3/8] As OpenMP states:

"If trait-property 'any' is specified in the 'kind' trait-selector of the device selector set or the target_device selector sets, no other trait-property may be specified in the same selector set."

[From "Restrictions to context selectors are as follows:", here quoting TR12]

It seems as if we can avoid run-time evaluation for 'device' if there is a kind(any) - and likewise for 'target_device' if there is 'kind(any)', but we want to have an error in that case if any other trait has been specified, I guess.

* * *

Sandra Loosemore wrote:
@@ -2194,12 +2308,21 @@ omp_context_compute_score (tree ctx, score_wide_int 
*score, bool declare_simd)
...
      int *scores
        = (int *) alloca ((2 * nconstructs + 2) * sizeof (int));

That's not new but I have the feeling it should be '+ 3' and not '+ 2'
for device or target_device + and having both device and target device,
it might even need to be + 6.

I also wonder whether 'alloca' will really work - or only when inlined at all call sites.

Ignore the last sentence. ['scores' is used locally, while 'score' is passed by the caller.] Still, I wonder about the + 2 vs. +3 or +6.

Otherwise, I have not spotted anything.

Tobias


Reply via email to