-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL] Initial changes for C++11 ABI=0 support #12193
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
Changes from 12 commits
2d34c19
4dabfd3
108bf4d
d7f21ab
34cd0b9
ded92db
77aaeba
fa6a931
5709e28
da8ab9f
841f042
a79d58f
74bb97d
7cebd8d
20448f7
95f48f8
f0aa89c
a1e4479
312cda8
1db3ca8
d83490d
273f4b0
ac1ee03
436288b
84f8e2d
db67a87
66c0405
4823b25
cff7fae
3af523e
f918818
316627a
741db80
2db4e56
22a59c6
4e28f9f
e24da9c
f707404
272e400
67ecf71
e385649
8a9aaaf
2adf0fb
a309a8d
537491d
8fc92b8
f9a9af4
0aa4158
b51cb8a
6e7da0a
05a0ca1
ecb8ce9
6f36028
f4655aa
a04fc0c
a803e6d
a22fd4a
429c7a3
b18eb02
4f0d634
9d9cf42
921b754
bf313f1
32a0401
431ac8d
a4c2ffa
273248b
182afc7
0a97845
d62e175
3fdd985
8d1fa21
232e759
019d30b
36e5dd8
b074631
524d53d
4f9b8d4
fa1ae30
7095cf7
d6c7ddc
82febee
1748dea
5a37c73
7780ca5
3bc950d
0bf1237
f31b89c
037a13b
962fa26
d6ab3ca
7eb7314
a11280e
f85a76a
1327442
05dc42d
050509e
dd8e563
ffa36e1
5c0b8a1
28ad4fc
823614d
c702858
f1bf10d
43a7823
37be2ba
82908d5
1ca910c
d88422a
b48f868
6e18644
0d19467
85b7d36
b79a347
1650d6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//==----------------- string.hpp - SYCL standard header file ---------------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
namespace sycl { | ||
inline namespace _V1 { | ||
namespace detail { | ||
|
||
class string { | ||
const char *str; // used to send existing std::string to libsycl | ||
char *ret_str = nullptr; // set from libsycl | ||
|
||
public: | ||
string() : str(nullptr), ret_str(nullptr) {} | ||
string(const char *ptr) : str(ptr) {} | ||
string(std::string strn) : str(strn.c_str()) {} | ||
bso-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
bool operator==(const char *st) { return strcmp(str, st) == 0; } | ||
|
||
std::string marshall() { return std::string(ret_str); } | ||
bso-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
std::string marshall() const { return std::string(ret_str); } | ||
|
||
void unmarshall(std::string &strn) { strcpy(ret_str, strn.c_str()); } | ||
|
||
void allocate(int size) { ret_str = new char[size]; } | ||
bso-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
void deallocate() { delete[] ret_str; } | ||
bso-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const char *getPtr() { return str; } | ||
|
||
const char *getPtr() const { return str; } | ||
|
||
char *getRetPtr() { return ret_str; } | ||
}; | ||
|
||
} // namespace detail | ||
} // namespace _V1 | ||
} // namespace sycl |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
#include <sycl/detail/pi.h> | ||
#include <sycl/detail/pi.hpp> | ||
#include <sycl/detail/reduction_forward.hpp> | ||
#include <sycl/detail/string.hpp> | ||
#include <sycl/device.hpp> | ||
#include <sycl/event.hpp> | ||
#include <sycl/exception.hpp> | ||
|
@@ -548,7 +549,11 @@ class __SYCL_EXPORT handler { | |
bool IsKernelCreatedFromSource, bool IsESIMD); | ||
|
||
/// \return a string containing name of SYCL kernel. | ||
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
detail::string getKernelName(); | ||
#else | ||
std::string getKernelName(); | ||
#endif | ||
|
||
template <typename LambdaNameT> bool lambdaAndKernelHaveEqualName() { | ||
// TODO It is unclear a kernel and a lambda/functor must to be equal or not | ||
|
@@ -558,8 +563,13 @@ class __SYCL_EXPORT handler { | |
// values of arguments for the kernel. | ||
assert(MKernel && "MKernel is not initialized"); | ||
const std::string LambdaName = detail::KernelInfo<LambdaNameT>::getName(); | ||
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
detail::string KernelName = getKernelName(); | ||
bso-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return LambdaName == KernelName.marshall(); | ||
#else | ||
const std::string KernelName = getKernelName(); | ||
return LambdaName == KernelName; | ||
#endif | ||
} | ||
|
||
/// Saves the location of user's code passed in \p CodeLoc for future usage in | ||
|
@@ -842,7 +852,15 @@ class __SYCL_EXPORT handler { | |
/// | ||
/// \param KernelName is the name of the SYCL kernel to check that the used | ||
/// kernel bundle contains. | ||
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
void verifyUsedKernelBundle(const std::string &KernelName) { | ||
detail::string Name = detail::string(KernelName); | ||
verifyUsedKernelBundleInternal(Name); | ||
} | ||
void verifyUsedKernelBundleInternal(detail::string &KernelName); | ||
#else | ||
void verifyUsedKernelBundle(const std::string &KernelName); | ||
#endif | ||
|
||
/// Stores lambda to the template-free object | ||
/// | ||
|
@@ -3294,7 +3312,11 @@ class __SYCL_EXPORT handler { | |
std::vector<detail::ArgDesc> MAssociatedAccesors; | ||
/// Struct that encodes global size, local size, ... | ||
detail::NDRDescT MNDRDesc; | ||
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
detail::string MKernelName; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Every use of this seems to expect an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this private data member should cross the ABI boundary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, that brings another question. How are you testing that there are no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, have you tried changing callees accepting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't check everywhere at this moment.
I am not sure if I understand this question correctly, so please correct me if I misunderstood you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do they really need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well.. That's called code pollution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only partially agree with that. I think many of these interfaces currently accept |
||
#else | ||
std::string MKernelName; | ||
#endif | ||
/// Storage for a sycl::kernel object. | ||
std::shared_ptr<detail::kernel_impl> MKernel; | ||
/// Type of the command group, e.g. kernel, fill. Can also encode version. | ||
|
@@ -3396,17 +3418,35 @@ class __SYCL_EXPORT handler { | |
/// expr m_Storage member | ||
/// \param Size the size of data getting read back / to. | ||
/// \param Block if read operation is blocking, default to false. | ||
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
void ext_intel_read_host_pipe(const std::string &Name, void *Ptr, size_t Size, | ||
bool Block = false) { | ||
ext_intel_read_host_pipe(detail::string(Name), Ptr, Size, Block); | ||
} | ||
void ext_intel_read_host_pipe(const detail::string &Name, void *Ptr, | ||
size_t Size, bool Block = false); | ||
#else | ||
void ext_intel_read_host_pipe(const std::string &Name, void *Ptr, size_t Size, | ||
bool Block = false); | ||
#endif | ||
|
||
/// Write to host pipes given a host address and | ||
/// \param Name name of the host pipe to be passed into lower level runtime | ||
/// \param Ptr host pointer of host pipe as identified by address of its const | ||
/// expr m_Storage member | ||
/// \param Size the size of data getting read back / to. | ||
/// \param Block if write opeartion is blocking, default to false. | ||
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
void ext_intel_write_host_pipe(const std::string &Name, void *Ptr, | ||
size_t Size, bool Block = false) { | ||
ext_intel_write_host_pipe(detail::string(Name), Ptr, Size, Block); | ||
} | ||
void ext_intel_write_host_pipe(const detail::string &Name, void *Ptr, | ||
size_t Size, bool Block = false); | ||
#else | ||
void ext_intel_write_host_pipe(const std::string &Name, void *Ptr, | ||
size_t Size, bool Block = false); | ||
#endif | ||
friend class ext::oneapi::experimental::detail::graph_impl; | ||
|
||
bool DisableRangeRounding(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.