Skip to content

[SYCL] Support sycl::kernel_bundle for multi-device scenario #15546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions sycl/cmake/modules/UnifiedRuntimeTag.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# commit c742ca49efb12380a35b8b0b467e6577ab8174ce
# Merge: 3a8bf2c5 504d3b63
# Author: Kenneth Benzie (Benie) <[email protected]>
# Date: Mon Oct 21 11:55:23 2024 +0100
# Merge pull request #2131 from Bensuo/ben/command-handle-fix
# [EXP][CMDBUF] Make command handle behaviour consistent
set(UNIFIED_RUNTIME_TAG c742ca49efb12380a35b8b0b467e6577ab8174ce)
# commit 3db3a5e2d935630f2ffddd93a72ae0aa9af89acb
# Author: Artur Gainullin <[email protected]>
# Date: Tue Oct 22 03:30:08 2024 -0700
#
# Support UR program creation from multiple device binaries (#2147)
set(UNIFIED_RUNTIME_TAG 3db3a5e2d935630f2ffddd93a72ae0aa9af89acb)
3 changes: 2 additions & 1 deletion sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <sycl/property_list.hpp>

#include <algorithm>
#include <set>

namespace sycl {
inline namespace _V1 {
Expand Down Expand Up @@ -492,7 +493,7 @@ std::optional<ur_program_handle_t> context_impl::getProgramForDevImgs(
auto &Cache = LockedCache.get().Cache;
ur_device_handle_t &DevHandle = getSyclObjImpl(Device)->getHandleRef();
for (std::uintptr_t ImageIDs : ImgIdentifiers) {
auto OuterKey = std::make_pair(ImageIDs, DevHandle);
auto OuterKey = std::make_pair(ImageIDs, std::set{DevHandle});
size_t NProgs = KeyMap.count(OuterKey);
if (NProgs == 0)
continue;
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ retrieveKernelBinary(const QueueImplPtr &Queue, const char *KernelName,
auto DeviceImpl = Queue->getDeviceImplPtr();
auto Device = detail::createSyclObjFromImpl<device>(DeviceImpl);
ur_program_handle_t Program =
detail::ProgramManager::getInstance().createURProgram(**DeviceImage,
Context, Device);
detail::ProgramManager::getInstance().createURProgram(
**DeviceImage, Context, {Device});
return {*DeviceImage, Program};
}

Expand Down Expand Up @@ -94,7 +94,7 @@ retrieveKernelBinary(const QueueImplPtr &Queue, const char *KernelName,
DeviceImage = &detail::ProgramManager::getInstance().getDeviceImage(
KernelName, Context, Device);
Program = detail::ProgramManager::getInstance().createURProgram(
*DeviceImage, Context, Device);
*DeviceImage, Context, {Device});
}
return {DeviceImage, Program};
}
Expand Down
8 changes: 5 additions & 3 deletions sycl/source/detail/kernel_program_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <atomic>
#include <condition_variable>
#include <mutex>
#include <set>
#include <type_traits>

#include <boost/unordered/unordered_flat_map.hpp>
Expand Down Expand Up @@ -118,9 +119,10 @@ class KernelProgramCache {
* when debugging environment variables are set and we can just ignore them
* since all kernels will have their build options overridden with the same
* string*/
using ProgramCacheKeyT =
std::pair<std::pair<SerializedObj, std::uintptr_t>, ur_device_handle_t>;
using CommonProgramKeyT = std::pair<std::uintptr_t, ur_device_handle_t>;
using ProgramCacheKeyT = std::pair<std::pair<SerializedObj, std::uintptr_t>,
std::set<ur_device_handle_t>>;
using CommonProgramKeyT =
std::pair<std::uintptr_t, std::set<ur_device_handle_t>>;

struct ProgramCache {
::boost::unordered_map<ProgramCacheKeyT, ProgramBuildResultPtr> Cache;
Expand Down
Loading
Loading