-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL][NFCI] Drop ESIMD emulator leftovers #15495
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
AlexeySachkov
merged 4 commits into
intel:sycl
from
AlexeySachkov:private/asachkov/drop-esimd-emulator-legacy
Sep 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
301258f
[SYCL][NFCI] Drop ESIMD emulator leftovers
AlexeySachkov cf21174
Remove unrelated changes
AlexeySachkov ed3589e
Apply review comments
AlexeySachkov 913db74
Merge remote-tracking branch 'origin/sycl' into private/asachkov/drop…
AlexeySachkov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -767,130 +767,6 @@ class __SYCL_EXPORT handler { | |
| &DynamicParamBase, | ||
| int ArgIndex); | ||
|
|
||
| /* The kernel passed to StoreLambda can take an id, an item or an nd_item as | ||
| * its argument. Since esimd adapter directly invokes the kernel (doesn’t use | ||
| * urKernelSetArg), the kernel argument type must be known to the adapter. | ||
| * However, passing kernel argument type to the adapter requires changing ABI | ||
| * in HostKernel class. To overcome this problem, helpers below wrap the | ||
| * “original” kernel with a functor that always takes an nd_item as argument. | ||
| * A functor is used instead of a lambda because extractArgsAndReqsFromLambda | ||
| * needs access to the “original” kernel and keeps references to its internal | ||
| * data, i.e. the kernel passed as argument cannot be local in scope. The | ||
| * functor itself is again encapsulated in a std::function since functor’s | ||
| * type is unknown to the adapter. | ||
| */ | ||
|
|
||
| // For 'id, item w/wo offset, nd_item' kernel arguments | ||
| template <class KernelType, class NormalizedKernelType, int Dims> | ||
| KernelType *ResetHostKernelHelper(const KernelType &KernelFunc) { | ||
| NormalizedKernelType NormalizedKernel(KernelFunc); | ||
| auto NormalizedKernelFunc = | ||
| std::function<void(const sycl::nd_item<Dims> &)>(NormalizedKernel); | ||
| auto HostKernelPtr = new detail::HostKernel<decltype(NormalizedKernelFunc), | ||
| sycl::nd_item<Dims>, Dims>( | ||
| std::move(NormalizedKernelFunc)); | ||
| MHostKernel.reset(HostKernelPtr); | ||
| return &HostKernelPtr->MKernel.template target<NormalizedKernelType>() | ||
| ->MKernelFunc; | ||
| } | ||
|
|
||
| // For 'sycl::id<Dims>' kernel argument | ||
| template <class KernelType, typename ArgT, int Dims> | ||
| std::enable_if_t<std::is_same_v<ArgT, sycl::id<Dims>>, KernelType *> | ||
| ResetHostKernel(const KernelType &KernelFunc) { | ||
| struct NormalizedKernelType { | ||
| KernelType MKernelFunc; | ||
| NormalizedKernelType(const KernelType &KernelFunc) | ||
| : MKernelFunc(KernelFunc) {} | ||
| void operator()(const nd_item<Dims> &Arg) { | ||
| detail::runKernelWithArg(MKernelFunc, Arg.get_global_id()); | ||
| } | ||
| }; | ||
| return ResetHostKernelHelper<KernelType, struct NormalizedKernelType, Dims>( | ||
| KernelFunc); | ||
| } | ||
|
|
||
| // For 'sycl::nd_item<Dims>' kernel argument | ||
| template <class KernelType, typename ArgT, int Dims> | ||
| std::enable_if_t<std::is_same_v<ArgT, sycl::nd_item<Dims>>, KernelType *> | ||
| ResetHostKernel(const KernelType &KernelFunc) { | ||
| struct NormalizedKernelType { | ||
| KernelType MKernelFunc; | ||
| NormalizedKernelType(const KernelType &KernelFunc) | ||
| : MKernelFunc(KernelFunc) {} | ||
| void operator()(const nd_item<Dims> &Arg) { | ||
| detail::runKernelWithArg(MKernelFunc, Arg); | ||
| } | ||
| }; | ||
| return ResetHostKernelHelper<KernelType, struct NormalizedKernelType, Dims>( | ||
| KernelFunc); | ||
| } | ||
|
|
||
| // For 'sycl::item<Dims, without_offset>' kernel argument | ||
| template <class KernelType, typename ArgT, int Dims> | ||
| std::enable_if_t<std::is_same_v<ArgT, sycl::item<Dims, false>>, KernelType *> | ||
| ResetHostKernel(const KernelType &KernelFunc) { | ||
| struct NormalizedKernelType { | ||
| KernelType MKernelFunc; | ||
| NormalizedKernelType(const KernelType &KernelFunc) | ||
| : MKernelFunc(KernelFunc) {} | ||
| void operator()(const nd_item<Dims> &Arg) { | ||
| sycl::item<Dims, false> Item = detail::Builder::createItem<Dims, false>( | ||
| Arg.get_global_range(), Arg.get_global_id()); | ||
| detail::runKernelWithArg(MKernelFunc, Item); | ||
| } | ||
| }; | ||
| return ResetHostKernelHelper<KernelType, struct NormalizedKernelType, Dims>( | ||
| KernelFunc); | ||
| } | ||
|
|
||
| // For 'sycl::item<Dims, with_offset>' kernel argument | ||
| template <class KernelType, typename ArgT, int Dims> | ||
| std::enable_if_t<std::is_same_v<ArgT, sycl::item<Dims, true>>, KernelType *> | ||
| ResetHostKernel(const KernelType &KernelFunc) { | ||
| struct NormalizedKernelType { | ||
| KernelType MKernelFunc; | ||
| NormalizedKernelType(const KernelType &KernelFunc) | ||
| : MKernelFunc(KernelFunc) {} | ||
| void operator()(const nd_item<Dims> &Arg) { | ||
| sycl::item<Dims, true> Item = detail::Builder::createItem<Dims, true>( | ||
| Arg.get_global_range(), Arg.get_global_id(), Arg.get_offset()); | ||
| detail::runKernelWithArg(MKernelFunc, Item); | ||
| } | ||
| }; | ||
| return ResetHostKernelHelper<KernelType, struct NormalizedKernelType, Dims>( | ||
| KernelFunc); | ||
| } | ||
|
|
||
| // For 'void' kernel argument (single_task) | ||
| template <class KernelType, typename ArgT, int Dims> | ||
| typename std::enable_if_t<std::is_same_v<ArgT, void>, KernelType *> | ||
| ResetHostKernel(const KernelType &KernelFunc) { | ||
| struct NormalizedKernelType { | ||
| KernelType MKernelFunc; | ||
| NormalizedKernelType(const KernelType &KernelFunc) | ||
| : MKernelFunc(KernelFunc) {} | ||
| void operator()(const nd_item<Dims> &Arg) { | ||
| (void)Arg; | ||
| detail::runKernelWithoutArg(MKernelFunc); | ||
| } | ||
| }; | ||
| return ResetHostKernelHelper<KernelType, struct NormalizedKernelType, Dims>( | ||
| KernelFunc); | ||
| } | ||
|
|
||
| // For 'sycl::group<Dims>' kernel argument | ||
| // 'wrapper'-based approach using 'NormalizedKernelType' struct is not used | ||
| // for 'void(sycl::group<Dims>)' since 'void(sycl::group<Dims>)' is not | ||
| // supported in ESIMD. | ||
| template <class KernelType, typename ArgT, int Dims> | ||
| std::enable_if_t<std::is_same_v<ArgT, sycl::group<Dims>>, KernelType *> | ||
| ResetHostKernel(const KernelType &KernelFunc) { | ||
| MHostKernel.reset( | ||
| new detail::HostKernel<KernelType, ArgT, Dims>(KernelFunc)); | ||
| return (KernelType *)(MHostKernel->getPtr()); | ||
| } | ||
|
|
||
| /// Verifies the kernel bundle to be used if any is set. This throws a | ||
| /// sycl::exception with error code errc::kernel_not_supported if the used | ||
| /// kernel bundle does not contain a suitable device image with the requested | ||
|
|
@@ -918,8 +794,8 @@ class __SYCL_EXPORT handler { | |
| detail::KernelLambdaHasKernelHandlerArgT<KernelType, | ||
| LambdaArgType>::value; | ||
|
|
||
| KernelType *KernelPtr = | ||
| ResetHostKernel<KernelType, LambdaArgType, Dims>(KernelFunc); | ||
| MHostKernel.reset( | ||
| new detail::HostKernel<KernelType, LambdaArgType, Dims>(KernelFunc)); | ||
|
||
|
|
||
| constexpr bool KernelHasName = | ||
| detail::getKernelName<KernelName>() != nullptr && | ||
|
|
@@ -950,7 +826,7 @@ class __SYCL_EXPORT handler { | |
| if (KernelHasName) { | ||
| // TODO support ESIMD in no-integration-header case too. | ||
| clearArgs(); | ||
| extractArgsAndReqsFromLambda(reinterpret_cast<char *>(KernelPtr), | ||
| extractArgsAndReqsFromLambda(MHostKernel->getPtr(), | ||
| detail::getKernelParamDescs<KernelName>(), | ||
| detail::isKernelESIMD<KernelName>()); | ||
| MKernelName = detail::getKernelName<KernelName>(); | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.