Skip to content

Commit cf97ef9

Browse files
committed
Update PCH enable logic
1. Some extensions are GPU only, add macro to manage 2. Add corner cases that detects cl_khr_fp64
1 parent fe597f8 commit cf97ef9

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

options_compile.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,29 +230,44 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
230230

231231
for (auto it = effectiveArgs.begin(), end = effectiveArgs.end(); it != end;
232232
++it) {
233-
if (it->compare("-Dcl_khr_fp64") == 0)
233+
if (it->compare("-Dcl_khr_fp64") == 0 || it->compare("-D cl_khr_fp64=1") == 0)
234234
fp64Enabled = true;
235+
else if (it->compare("-U cl_khr_fp64") == 0)
236+
fp64Enabled = false;
237+
// Find last position that enables or disables cl_khr_fp64
238+
else if (it->find("cl_khr_fp64") != std::string::npos) {
239+
auto NegFp64 = it->rfind("-cl_khr_fp64");
240+
auto PosFp64 = it->rfind("+cl_khr_fp64");
241+
if(NegFp64 != std::string::npos && PosFp64 != std::string::npos)
242+
fp64Enabled = PosFp64 > NegFp64;
243+
else if(NegFp64 != std::string::npos)
244+
fp64Enabled = false;
245+
else
246+
fp64Enabled = true;
247+
}
235248
}
236249

237250
std::map<std::string, bool> extMap{
238251
{"cl_khr_3d_image_writes", true},
239252
{"cl_khr_depth_images", true},
253+
#ifdef GPU_EXT
240254
{"cl_khr_fp16", true},
255+
{"cl_khr_mipmap_image", true},
256+
{"cl_khr_mipmap_image_writes", true},
257+
{"cl_khr_subgroups", true},
258+
{"cl_intel_device_side_avc_motion_estimation", true},
259+
{"cl_intel_planar_yuv", true},
241260
#ifdef _WIN32
242261
// cl_khr_gl_msaa_sharing is only supported on Windows [NEO].
243262
{"cl_khr_gl_msaa_sharing", true},
263+
#endif
244264
#endif
245265
{"cl_khr_global_int32_base_atomics", true},
246266
{"cl_khr_global_int32_extended_atomics", true},
247267
{"cl_khr_int64_base_atomics", true},
248268
{"cl_khr_int64_extended_atomics", true},
249269
{"cl_khr_local_int32_base_atomics", true},
250270
{"cl_khr_local_int32_extended_atomics", true},
251-
{"cl_khr_mipmap_image", true},
252-
{"cl_khr_mipmap_image_writes", true},
253-
{"cl_khr_subgroups", true},
254-
{"cl_intel_device_side_avc_motion_estimation", true},
255-
{"cl_intel_planar_yuv", true},
256271
{"cl_intel_subgroups", true},
257272
{"cl_intel_subgroups_short", true}};
258273

0 commit comments

Comments
 (0)