@@ -618,6 +618,151 @@ property, but the duplicates have no effect.
618618_{endnote}_]
619619|====
620620
621+ === New free function for linking
622+
623+ This extension adds the following new free functions to link kernel bundles in
624+ `object` state. This differs from the regular `sycl::link` function the
625+ additional property list argument.
626+
627+ |====
628+ a|
629+ [frame=all,grid=none]
630+ !====
631+ a!
632+ [source,c++]
633+ ----
634+ namespace sycl::ext::oneapi::experimental {
635+
636+ template<typename PropertyListT = empty_properties_t>
637+ kernel_bundle<bundle_state::executable>
638+ link(const std::vector<kernel_bundle<bundle_state::object>>& objectBundles,
639+ const std::vector<device>& devs, PropertyListT props = {});
640+
641+ } // namespace sycl::ext::oneapi::experimental
642+ ----
643+ !====
644+
645+ _Constraints:_ Available only when `PropertyListT` is an instance of
646+ `sycl::ext::oneapi::experimental::properties` which contains no properties
647+ other than those listed below in the section "New properties for the
648+ `link` function".
649+
650+ _Effects:_ Duplicate device images from `objectBundles` are eliminated as though
651+ they were joined via `join()`, then the remaining device images are translated
652+ into one or more new device images of state `bundle_state::executable`, and a
653+ new kernel bundle is created to contain these new device images. The new bundle
654+ represents all of the kernels in `objectBundles` that are compatible with at
655+ least one of the devices in `devs`. Any remaining kernels (those that are not
656+ compatible with any of the devices in `devs`) are not linked and not represented
657+ in the new bundle.
658+
659+ The new bundle has the same associated context as those in `objectBundles`, and
660+ the new bundle’s set of associated devices is `devs` (with duplicate devices
661+ removed).
662+
663+ _Returns:_ The new kernel bundle.
664+
665+ _Throws:_
666+
667+ * An `exception` with the `errc::invalid` error code if the bundles in
668+ `objectBundles` do not all have the same associated context.
669+
670+ * An `exception` with the `errc::invalid` error code if any of the devices in
671+ `devs` are not in the set of associated devices for any of the bundles in
672+ `objectBundles` (as defined by `kernel_bundle::get_devices()`) or if the `devs`
673+ vector is empty.
674+
675+ * An `exception` with the `errc::build` error code if the online link operation
676+ fails.
677+
678+
679+ a|
680+ [frame=all,grid=none]
681+ !====
682+ a!
683+ [source]
684+ ----
685+
686+ namespace sycl::ext::oneapi::experimental {
687+
688+ template<typename PropertyListT = empty_properties_t> (1)
689+ kernel_bundle<bundle_state::executable>
690+ link(const kernel_bundle<bundle_state::object>& objectBundle,
691+ const std::vector<device>& devs, PropertyListT props = {});
692+
693+ template<typename PropertyListT = empty_properties_t> (2)
694+ kernel_bundle<bundle_state::executable>
695+ link(const std::vector<kernel_bundle<bundle_state::object>>& objectBundles,
696+ PropertyListT props = {});
697+
698+ template<typename PropertyListT = empty_properties_t> (3)
699+ kernel_bundle<bundle_state::executable>
700+ link(const kernel_bundle<bundle_state::object>& objectBundle,
701+ PropertyListT props = {});
702+
703+ } // namespace sycl::ext::oneapi::experimental
704+ ----
705+ !====
706+
707+ _Effects (1):_ Equivalent to `link({objectBundle}, devs, props)`.
708+
709+ _Effects (2):_ Equivalent to `link(objectBundles, devs, props)`, where `devs` is
710+ the intersection of associated devices in common for all bundles in
711+ `objectBundles`.
712+
713+ _Effects (3):_ Equivalent to
714+ `link({objectBundle}, objectBundle.get_devices(), props)`.
715+
716+
717+ |====
718+
719+ === New properties for the `link` function
720+
721+ This extension adds the following properties, which can be used in conjunction
722+ with the `link` function that is defined above:
723+
724+ |====
725+ a|
726+ [frame=all,grid=none]
727+ !====
728+ a!
729+ [source,c++]
730+ ----
731+ namespace sycl::ext::oneapi::experimental {
732+
733+ struct fast_link {
734+ fast_link(bool do_fast_link = true); (1)
735+
736+ bool value;
737+ };
738+ using fast_link_key = fast_link;
739+
740+ template<> struct is_property_key<fast_link_key> : std::true_type {};
741+
742+ } // namespace sycl::ext::oneapi::experimental
743+ ----
744+ !====
745+
746+ This property instructs the `link` operation to do "fast linking". Enabling this
747+ instructs the implementation to use device binary images that have been
748+ pre-compiled.
749+
750+ Fast linking offers potentially faster link times, at the potential cost of
751+ slower kernel execution time. The latter effect would mainly be due to link-time
752+ optimizations the device compiler could have done during regular linking, that
753+ cannot be done when doing fast linking.
754+
755+ For example, the binaries produced may contain ahead-of-time compiled binary
756+ images together with just-in-time compiled binary images, with the kernels and
757+ exported functions potentially overlapping. When fast-linking is enabled, the
758+ implementation will try to use the ahead-of-time compiled binary images over
759+ their just-in-time compiled counterparts.
760+
761+ _Effects (1):_ Creates a new `fast_link` property with a boolean value
762+ indicating whether the `link` operation should do fast-linking.
763+
764+ |====
765+
621766=== New constraint for kernel bundle member functions
622767
623768This extension adds the following constraint to some of the `kernel_bundle`
0 commit comments