Skip to content

Commit 22b7583

Browse files
committed
Split exceptions dictionary in two
1 parent e19c435 commit 22b7583

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

sycl/test-e2e/format.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,31 +99,33 @@ def getMatchedFromList(self, features, alist):
9999
raise ValueError("Error in UNSUPPORTED list:\n%s" % str(e))
100100

101101
def make_default_features_list(self, expr, triple, add_default=True):
102-
# Dictionary of features which we know are always/never present for a
102+
# Dictionaries of features which we know are always/never present for a
103103
# given triple (or the system in general).
104-
exceptions = {}
105-
exceptions["spir64"] = {
106-
"cuda": False,
107-
"hip": False,
108-
"hip_amd": False,
109-
"hip_nvidia": False,
110-
"native_cpu": False,
104+
always_has_feature = {
105+
"spir64": set(),
106+
"system": {"linux"},
111107
}
112-
exceptions["system"] = {
113-
"linux": True,
114-
"windows": False,
115-
"system-windows": False,
116-
"run-mode": False,
117-
"TEMPORARY_DISABLED": False,
108+
never_has_feature = {
109+
"spir64": {
110+
"cuda", "hip", "hip_amd", "hip_nvidia", "native_cpu"
111+
},
112+
"system": {
113+
"windows", "system-windows", "run-mode", "TEMPORARY_DISABLED",
114+
},
118115
}
119116
features_queried_by_test = []
120117
for f in expr:
121118
features_queried_by_test = features_queried_by_test + re.findall(
122119
"[-+=._a-zA-Z0-9]+", f
123120
)
124121
features = set()
122+
exceptions = {}
123+
if add_default:
124+
exceptions = never_has_feature[triple].union(never_has_feature["system"])
125+
else:
126+
exceptions = always_has_feature[triple].union(always_has_feature["system"])
125127
for f in features_queried_by_test:
126-
if exceptions[triple].get(f, exceptions["system"].get(f, add_default)):
128+
if (not add_default if f in exceptions else add_default):
127129
features.add(f)
128130
return features
129131

0 commit comments

Comments
 (0)