@@ -118,33 +118,27 @@ static bool isDeviceBinaryTypeSupported(context_impl &ContextImpl,
118118 devices_range Devices = ContextImpl.getDevices ();
119119
120120 // Program type is SPIR-V, so we need a device compiler to do JIT.
121- for ( device_impl &D : Devices ) {
122- if (! D.get_info <info::device::is_compiler_available>())
123- return false ;
124- }
121+ if (! all_of (Devices, []( device_impl &D) {
122+ return D.get_info <info::device::is_compiler_available>();
123+ }))
124+ return false ;
125125
126126 // OpenCL 2.1 and greater require clCreateProgramWithIL
127127 if (ContextBackend == backend::opencl) {
128- std::string ver = ContextImpl. get_info <info::context::platform>()
129- .get_info <info::platform::version>();
128+ std::string ver =
129+ ContextImpl. getPlatformImpl () .get_info <info::platform::version>();
130130 if (ver.find (" OpenCL 1.0" ) == std::string::npos &&
131131 ver.find (" OpenCL 1.1" ) == std::string::npos &&
132132 ver.find (" OpenCL 1.2" ) == std::string::npos &&
133133 ver.find (" OpenCL 2.0" ) == std::string::npos)
134134 return true ;
135135 }
136136
137- for (device_impl &D : Devices) {
138- // We need cl_khr_il_program extension to be present
139- // and we can call clCreateProgramWithILKHR using the extension
140- std::vector<std::string> Extensions =
141- D.get_info <info::device::extensions>();
142- if (Extensions.end () ==
143- std::find (Extensions.begin (), Extensions.end (), " cl_khr_il_program" ))
144- return false ;
145- }
146-
147- return true ;
137+ // We need cl_khr_il_program extension to be present
138+ // and we can call clCreateProgramWithILKHR using the extension
139+ return all_of (Devices, [](device_impl &D) {
140+ return D.has_extension (" cl_khr_il_program" );
141+ });
148142}
149143
150144// getFormatStr is used for debug-printing, so it may be unused.
0 commit comments