Skip to content
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

[SYCL] Add runtime support for split device binaries #759

Merged
merged 11 commits into from
Dec 6, 2019

Conversation

sergey-semenov
Copy link
Contributor

This patch enables usage of multiple split device binaries per OS
module (executable or shared object file). The required binary is
chosen based on the entry table (filled by clang-offload-wrapper)
that lists all kernels contained within.

Signed-off-by: Sergey Semenov sergey.semenov@intel.com

@sergey-semenov
Copy link
Contributor Author

TODO: add a test once the driver supports split device binaries

sycl/include/CL/sycl/detail/pi.h Outdated Show resolved Hide resolved
sycl/source/detail/context_impl.cpp Outdated Show resolved Hide resolved
sycl/source/detail/context_impl.cpp Outdated Show resolved Hide resolved
sycl/source/detail/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/source/detail/program_manager/program_manager.cpp Outdated Show resolved Hide resolved
sycl/source/detail/program_manager/program_manager.cpp Outdated Show resolved Hide resolved
sycl/source/detail/program_manager/program_manager.cpp Outdated Show resolved Hide resolved
sycl/doc/SYCLPluginInterface.md Outdated Show resolved Hide resolved
sycl/include/CL/sycl/detail/program_impl.hpp Outdated Show resolved Hide resolved
sycl/source/detail/program_manager/program_manager.cpp Outdated Show resolved Hide resolved
sycl/source/detail/pi_opencl.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@smaslov-intel smaslov-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 9 files reviewed, 13 unresolved discussions (waiting on @AGindinson, @Fznamznon, @kbobrovs, @sergey-semenov, and @smaslov-intel)


sycl/doc/SYCLPluginInterface.md, line 101 at r1 (raw file):

The idea is that SYCL runtime should do as much arch-neutral tasks as possible. So for each architecture SYCL runtime could maintain a mapping from kernel name to a set of device binaries which have this kernel implemented. Those binaries are then offered via this interface to the plugin covering this architecture to select the best fit. If there is just 1 such binary (most cases), no call to piextDeviceSelectBinary is needed.

Agreed.


sycl/include/CL/sycl/detail/pi.h, line 429 at r1 (raw file):

Previously, AGindinson (Artem Gindinson) wrote…

Other declarations around this one seems to have their own formatting rules (apparently, "to look nicer"). Don't know if it matters much - just as a note

Right, let's keep each argument on its own line

@Fznamznon
Copy link
Contributor

@sergey-semenov , could you please rebase your changes?

Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not final review.

sycl/include/CL/sycl/detail/pi.h Show resolved Hide resolved
sycl/include/CL/sycl/detail/program_impl.hpp Outdated Show resolved Hide resolved
sycl/source/detail/program_manager/program_manager.cpp Outdated Show resolved Hide resolved
sycl/source/detail/program_manager/program_manager.cpp Outdated Show resolved Hide resolved
sycl/source/detail/program_manager/program_manager.cpp Outdated Show resolved Hide resolved
sycl/include/CL/sycl/detail/context_impl.hpp Show resolved Hide resolved
@sergey-semenov sergey-semenov force-pushed the splitimagesupport branch 3 times, most recently from ce3d8df to d46a5ce Compare December 2, 2019 16:13
Copy link
Contributor

@kbobrovs kbobrovs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSModuleHandle participation in kernel resolution remains the open question.

@sergey-semenov
Copy link
Contributor Author

Please add llvm headers to all new files.

Should we? #860 (comment)


// OpenCL 2.1 and greater require clCreateProgramWithIL
if (pi::useBackend(pi::SYCL_BE_PI_OPENCL) &&
C.get_platform().get_info<info::platform::version>() >= "2.1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this lexicographical comparison? Why it is considered reliable here? Maybe add a comment (later is OK)

/// map from a set of kernels to the vector of images containing them and
/// coming from the module.
/// Access must be guarded by the \ref Sync::getGlobalLock()
std::map<OSModuleHandle, KernelToImgsMap> m_DeviceImages;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like ordering of keys is not important here, so unordered_map with O(1) lookup time complexity can be used instead of map with O(log(n)). The same applies to all other maps here. Can be addressed in a separate PR.

sycl/include/CL/sycl/detail/common.hpp Show resolved Hide resolved
sycl/include/CL/sycl/detail/common.hpp Outdated Show resolved Hide resolved
sycl/include/CL/sycl/detail/common.hpp Outdated Show resolved Hide resolved
sergey-semenov and others added 11 commits December 5, 2019 19:28
This patch enables usage of multiple split device binaries per OS
module (executable or shared object file). The required binary is
chosen based on the entry table (filled by clang-offload-wrapper)
that lists all kernels contained within.

Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Co-authored-by: Sergey Semenov <sergey.semenov@intel.com>

Signed-off-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Copy link
Contributor

@kbobrovs kbobrovs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please address few other comments shortly after.

@bader bader merged commit 9095749 into intel:sycl Dec 6, 2019
@sergey-semenov sergey-semenov deleted the splitimagesupport branch December 6, 2019 15:48
aelovikov-intel pushed a commit that referenced this pull request Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants