Overview of closure_hydrator
The
closure_hydrator is a thread-local singleton designed to inject information into objects (such as host/device and local accessors) that have been captured in a lambda closure. It works by utilizing the copy constructor of captured objects to modify them while the containing closure is being copied via the hydrate() function. Accessors retrieve their specific information using unique "hydration ids" assigned at creation. Because kernel command function closures may be copied multiple times by SYCL, the hydrator must be explicitly enabled per-thread to prevent unintended hydration.