Skip to content

Commit 20b247c

Browse files
[SYCL] Fix ABI break after "Refactor HandlerAccess::postProcess" (#19502)
#19203 changed current reduction implementation but the old one was inlined into user applications and it relied on the `handler::MIsFinalized` hacky behavior. As such, we have to keep it in non-preview mode.
1 parent 25323c8 commit 20b247c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

sycl/source/handler.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,28 @@ detail::EventImplPtr handler::finalize() {
432432
#else
433433
event handler::finalize() {
434434
#endif
435+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
436+
// Old reduction implementation, prior to
437+
// https://github.com/intel/llvm/pull/18794
438+
// https://github.com/intel/llvm/pull/18898
439+
// https://github.com/intel/llvm/pull/19203
440+
// relied on explicit calls to handler::finalize and those calls were inlined
441+
// into the user applications. As such, we have to preserve the following
442+
// behavior for ABI-compatibility purposes:
443+
if (MIsFinalizedDoNotUse)
444+
return MLastEventDoNotUse;
445+
446+
MIsFinalizedDoNotUse = true;
447+
// Use macros to trick clang-format:
448+
#define WRAP_BODY_BEGIN MLastEventDoNotUse = [this]() {
449+
#define WRAP_BODY_END \
450+
} \
451+
(); \
452+
return MLastEventDoNotUse;
453+
454+
WRAP_BODY_BEGIN
455+
#endif
456+
435457
const auto &type = getType();
436458
detail::queue_impl *Queue = impl->get_queue_or_null();
437459
ext::oneapi::experimental::detail::graph_impl *Graph =
@@ -937,6 +959,13 @@ event handler::finalize() {
937959
#else
938960
return detail::createSyclObjFromImpl<event>(Event);
939961
#endif
962+
963+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
964+
WRAP_BODY_END
965+
966+
#undef WRAP_BODY_BEGIN
967+
#undef WRAP_BODY_END
968+
#endif
940969
}
941970

942971
void handler::addReduction(const std::shared_ptr<const void> &ReduObj) {

0 commit comments

Comments
 (0)