diff --git a/pyopencl/bitonic_sort_templates.py b/pyopencl/bitonic_sort_templates.py
index 4aafa439530e01d149b34a3af28d5cde36b0a48a..45f7288f263a6c04a6b544844980b1fa1364879e 100644
--- a/pyopencl/bitonic_sort_templates.py
+++ b/pyopencl/bitonic_sort_templates.py
@@ -39,7 +39,9 @@ LOCAL_MEM_FACTOR = 1
 defines = """//CL//
 
 % if dtype == "double":
+    #if __OPENCL_C_VERSION__ < 120
     #pragma OPENCL EXTENSION cl_khr_fp64: enable
+    #endif
 % endif
 
 typedef ${dtype} data_t;