Skip to content

Commit c891e1d

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 743bd15 commit c891e1d

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
@@ -237,29 +237,44 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
237237

238238
for (auto it = effectiveArgs.begin(), end = effectiveArgs.end(); it != end;
239239
++it) {
240-
if (it->compare("-Dcl_khr_fp64") == 0)
240+
if (it->compare("-Dcl_khr_fp64") == 0 || it->compare("-D cl_khr_fp64=1") == 0)
241241
fp64Enabled = true;
242+
else if (it->compare("-U cl_khr_fp64") == 0)
243+
fp64Enabled = false;
244+
// Find last position that enables or disables cl_khr_fp64
245+
else if (it->find("cl_khr_fp64") != std::string::npos) {
246+
auto NegFp64 = it->rfind("-cl_khr_fp64");
247+
auto PosFp64 = it->rfind("+cl_khr_fp64");
248+
if(NegFp64 != std::string::npos && PosFp64 != std::string::npos)
249+
fp64Enabled = PosFp64 > NegFp64;
250+
else if(NegFp64 != std::string::npos)
251+
fp64Enabled = false;
252+
else
253+
fp64Enabled = true;
254+
}
242255
}
243256

244257
std::map<std::string, bool> extMap{
245258
{"cl_khr_3d_image_writes", true},
246259
{"cl_khr_depth_images", true},
260+
#ifdef GPU_EXT
247261
{"cl_khr_fp16", true},
262+
{"cl_khr_mipmap_image", true},
263+
{"cl_khr_mipmap_image_writes", true},
264+
{"cl_khr_subgroups", true},
265+
{"cl_intel_device_side_avc_motion_estimation", true},
266+
{"cl_intel_planar_yuv", true},
248267
#ifdef _WIN32
249268
// cl_khr_gl_msaa_sharing is only supported on Windows [NEO].
250269
{"cl_khr_gl_msaa_sharing", true},
270+
#endif
251271
#endif
252272
{"cl_khr_global_int32_base_atomics", true},
253273
{"cl_khr_global_int32_extended_atomics", true},
254274
{"cl_khr_int64_base_atomics", true},
255275
{"cl_khr_int64_extended_atomics", true},
256276
{"cl_khr_local_int32_base_atomics", true},
257277
{"cl_khr_local_int32_extended_atomics", true},
258-
{"cl_khr_mipmap_image", true},
259-
{"cl_khr_mipmap_image_writes", true},
260-
{"cl_khr_subgroups", true},
261-
{"cl_intel_device_side_avc_motion_estimation", true},
262-
{"cl_intel_planar_yuv", true},
263278
{"cl_intel_subgroups", true},
264279
{"cl_intel_subgroups_short", true}};
265280

0 commit comments

Comments
 (0)