================
@@ -118,10 +119,36 @@ LLVM_ABI bool 
isValidTraitPropertyForTraitSetAndSelector(TraitProperty Property,
                                                          TraitSelector 
Selector,
                                                          TraitSet Set);
 
-/// Variant match information describes the required traits and how they are
-/// scored (via the ScoresMap). In addition, the required consturct nesting is
-/// decribed as well.
+/// Variant match information describes the required property traits, how they
+/// are scored, and the required construct nesting.
 struct VariantMatchInfo {
+  struct ISATrait {
+    TraitProperty Property;
+    StringRef Name;
+
+    bool operator==(const ISATrait &Other) const {
+      return Property == Other.Property && Name == Other.Name;
+    }
+  };
+
+  struct UnknownTrait {
+    TraitSelector Selector;
+    StringRef Name;
+    std::optional<APInt> Score;
+
+    // Subset checks compare property identity, not its score.
+    bool operator==(const UnknownTrait &Other) const {
+      return Selector == Other.Selector && Name == Other.Name;
+    }
+  };
+
+  /// Keep unknown properties inactive without losing their selector or score.
+  void addUnknownTrait(TraitSelector Selector, StringRef Name,
----------------
MattPD wrote:

Flang still records the unknown vendor names `foo` and `bar` as 
`TraitProperty::invalid`, so the new global subset rule treats distinct 
properties as identical. With `flang -fopenmp -fopenmp-version=52 -S -emit-llvm 
repro.f90 -o -`, this selects TASKWAIT at 82f18330 but TASKYIELD at the 
[parent](https://github.com/llvm/llvm-project/commit/6544686b4a86193fc0bf6d229d59df20a4251e7f):

```fortran
subroutine s()
  !$omp metadirective &
  !$omp& when(implementation={vendor(score(10): foo), extension(match_none)}: 
taskyield) &
  !$omp& when(implementation={vendor(score(1): bar), extension(match_none)}, &
  !$omp& device={kind(gpu)}: taskwait)
end subroutine
```

The first candidate scores 11 against 3 and is not a subset because `foo` and 
`bar` differ. Could the Flang producer retain three fields for each unknown 
property through this API: selector, name, and score? Could frontend tests 
cover distinct and identical unknown properties?

https://github.com/llvm/llvm-project/pull/231668
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to