@@ -26,26 +26,28 @@ using namespace sycl;
26
26
27
27
namespace esimd_test {
28
28
29
- // This is function provided to SYCL runtime by the application to decide
29
+ // This is the function provided to SYCL runtime by the application to decide
30
30
// on which device to run, or whether to run at all.
31
31
// When selecting a device, SYCL runtime first takes (1) a selector provided by
32
32
// the program or a default one and (2) the set of all available devices. Then
33
- // it passes each device to the selector. A device for which the highest number
34
- // is returned is selected. If a negative number was returned for all devices,
35
- // then the selection process will cause an exception.
33
+ // it passes each device to the '()' operator of the selector. Device, for
34
+ // which '()' returned the highest number, is selected. If a negative number
35
+ // was returned for all devices, then the selection process will cause an
36
+ // exception.
37
+ // Require GPU device
36
38
inline int ESIMDSelector (const device &device) {
37
- if (const char *dev_filter = getenv (" SYCL_DEVICE_FILTER" )) {
38
- std::string filter_string (dev_filter);
39
- if (filter_string.find (" gpu" ) != std::string::npos)
40
- return device.is_gpu () ? 1000 : -1 ;
41
-
42
- std::cerr
43
- << " Supported 'SYCL_DEVICE_FILTER' env var device type is 'gpu' and "
44
- << filter_string << " ' does not contain that.\n " ;
39
+ const std::string intel{" Intel(R) Corporation" };
40
+ if (device.get_backend () == backend::ext_intel_esimd_emulator) {
41
+ return 1000 ;
42
+ } else if (device.is_gpu () &&
43
+ (device.get_info <info::device::vendor>() == intel)) {
44
+ // pick gpu device if esimd not available but give it a lower score in
45
+ // order not to compete with the esimd in environments where both are
46
+ // present
47
+ return 900 ;
48
+ } else {
45
49
return -1 ;
46
50
}
47
- // If "SYCL_DEVICE_FILTER" not defined, only allow gpu device
48
- return device.is_gpu () ? 1000 : -1 ;
49
51
}
50
52
51
53
inline auto createExceptionHandler () {
0 commit comments