diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index bc8cf16c6da2a6115320e1792c9977e0d93ba554..65132c1744d828ab274d58a462779c98c80a7991 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -349,7 +349,10 @@ class Program(object):
         return self._get_prg().get_build_info(*args, **kwargs)
 
     def all_kernels(self):
-        return self._get_prg().all_kernels()
+        result = self._get_prg().all_kernels()
+        for knl in result:
+            knl._setup(self)
+        return result
 
     def int_ptr(self):
         return self._get_prg().int_ptr