File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,19 @@ template <> class SYCLConfig<SYCL_DEVICE_FILTER> {
184
184
static device_filter_list DFL{ValStr};
185
185
FilterList = &DFL;
186
186
}
187
+
188
+ // TODO: remove the following code when we remove the support for legacy
189
+ // env vars.
190
+ // Emit the deprecation warning message if SYCL_BE or SYCL_DEVICE_TYPE is
191
+ // set.
192
+ if (SYCLConfig<SYCL_BE>::get () || getenv (" SYCL_DEVICE_TYPE" )) {
193
+ std::cerr << " \n WARNING: The legacy environment variables SYCL_BE and "
194
+ " SYCL_DEVICE_TYPE are deprecated. Please use "
195
+ " SYCL_DEVICE_FILTER instead. For details, please refer to "
196
+ " https://github.com/intel/llvm/blob/sycl/sycl/doc/"
197
+ " EnvironmentVariables.md\n\n " ;
198
+ }
199
+
187
200
// As mentioned above, configuration parameters are processed only once.
188
201
// If multiple threads are checking this env var at the same time,
189
202
// they will end up setting the configration to the same value.
Original file line number Diff line number Diff line change @@ -131,11 +131,19 @@ int filter_selector_impl::operator()(const device &Dev) const {
131
131
} else {
132
132
BE = sycl::detail::getSyclObjImpl (Dev)->getPlugin ().getBackend ();
133
133
}
134
- BackendOK = (BE == Filter.Backend );
134
+ // Backend is okay if the filter BE is set 'all'.
135
+ if (Filter.Backend == backend::all)
136
+ BackendOK = true ;
137
+ else
138
+ BackendOK = (BE == Filter.Backend );
135
139
}
136
140
if (Filter.HasDeviceType ) {
137
141
info::device_type DT = Dev.get_info <info::device::device_type>();
138
- DeviceTypeOK = (DT == Filter.DeviceType );
142
+ // DeviceType is okay if the filter is set 'all'.
143
+ if (Filter.DeviceType == info::device_type::all)
144
+ DeviceTypeOK = true ;
145
+ else
146
+ DeviceTypeOK = (DT == Filter.DeviceType );
139
147
}
140
148
if (Filter.HasDeviceNum ) {
141
149
// Only check device number if we're good on the previous matches
Original file line number Diff line number Diff line change @@ -154,6 +154,12 @@ int default_selector::operator()(const device &dev) const {
154
154
if (dev.is_host ())
155
155
Score += 100 ;
156
156
157
+ // Since we deprecate SYCL_BE and SYCL_DEVICE_TYPE,
158
+ // we should not disallow accelerator to be chosen.
159
+ // But this device type gets the lowest heuristic point.
160
+ if (dev.is_accelerator ())
161
+ Score += 75 ;
162
+
157
163
return Score;
158
164
}
159
165
You can’t perform that action at this time.
0 commit comments