Skip to content

Commit 21fa910

Browse files
committed
Merge branch 'sycl' into pietro/events_initial
2 parents 4ebbb3a + 206e2e9 commit 21fa910

File tree

21 files changed

+658
-150
lines changed

21 files changed

+658
-150
lines changed

clang/include/clang/Basic/SourceManager.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,19 @@ class SourceManager : public RefCountedBase<SourceManager> {
906906
/// Get the file ID for the precompiled preamble if there is one.
907907
FileID getPreambleFileID() const { return PreambleFileID; }
908908

909+
/// Get the file ID for the integration footer.
910+
FileID ComputeValidFooterFileID(StringRef Footer) {
911+
FileID FooterFileID;
912+
llvm::Expected<FileEntryRef> ExpectedFileRef =
913+
getFileManager().getFileRef(Footer);
914+
if (ExpectedFileRef) {
915+
FooterFileID = getOrCreateFileID(ExpectedFileRef.get(),
916+
SrcMgr::CharacteristicKind::C_User);
917+
}
918+
assert(FooterFileID.isValid() && "expecting a valid footer FileID");
919+
return FooterFileID;
920+
}
921+
909922
//===--------------------------------------------------------------------===//
910923
// Methods to create new FileID's and macro expansions.
911924
//===--------------------------------------------------------------------===//

clang/lib/Frontend/PrintPreprocessedOutput.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -904,26 +904,14 @@ struct UnknownPragmaHandler : public PragmaHandler {
904904
};
905905
} // end anonymous namespace
906906

907-
FileID ComputeValidFooterFileID(SourceManager &SM, StringRef Footer) {
908-
FileID FooterFileID;
909-
llvm::Expected<FileEntryRef> ExpectedFileRef =
910-
SM.getFileManager().getFileRef(Footer);
911-
if (ExpectedFileRef) {
912-
FooterFileID = SM.getOrCreateFileID(ExpectedFileRef.get(),
913-
SrcMgr::CharacteristicKind::C_User);
914-
}
915-
assert(FooterFileID.isValid() && "expecting a valid footer FileID");
916-
return FooterFileID;
917-
}
918-
919907
static void PrintIncludeFooter(Preprocessor &PP, SourceLocation Loc,
920908
std::string Footer,
921909
PrintPPOutputPPCallbacks *Callbacks) {
922910
SourceManager &SourceMgr = PP.getSourceManager();
923911
PresumedLoc UserLoc = SourceMgr.getPresumedLoc(Loc);
924912
if (UserLoc.isInvalid())
925913
return;
926-
FileID FooterFileID = ComputeValidFooterFileID(SourceMgr, Footer);
914+
FileID FooterFileID = SourceMgr.ComputeValidFooterFileID(Footer);
927915
StringRef FooterContentBuffer = SourceMgr.getBufferData(FooterFileID);
928916
// print out the name of the integration footer.
929917
Callbacks->WriteFooterInfo(Footer);

clang/lib/Lex/PPLexerChange.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -326,18 +326,6 @@ void Preprocessor::diagnoseMissingHeaderInUmbrellaDir(const Module &Mod) {
326326
}
327327
}
328328

329-
static FileID ComputeValidFooterFileID(SourceManager &SM, StringRef Footer) {
330-
FileID FooterFileID;
331-
llvm::Expected<FileEntryRef> ExpectedFileRef =
332-
SM.getFileManager().getFileRef(Footer);
333-
if (ExpectedFileRef) {
334-
FooterFileID = SM.getOrCreateFileID(ExpectedFileRef.get(),
335-
SrcMgr::CharacteristicKind::C_User);
336-
}
337-
assert(FooterFileID.isValid() && "expecting a valid footer FileID");
338-
return FooterFileID;
339-
}
340-
341329
/// HandleEndOfFile - This callback is invoked when the lexer hits the end of
342330
/// the current file. This either returns the EOF token or pops a level off
343331
/// the include stack and keeps going.
@@ -552,8 +540,8 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) {
552540
SourceManager &SourceMgr = getSourceManager();
553541
SourceLocation Loc = CurLexer->getFileLoc();
554542

555-
FileID FooterFileID = ComputeValidFooterFileID(
556-
SourceMgr, getPreprocessorOpts().IncludeFooter);
543+
FileID FooterFileID =
544+
SourceMgr.ComputeValidFooterFileID(getPreprocessorOpts().IncludeFooter);
557545
if (!FooterFileID.isInvalid() && !IncludeFooterProcessed) {
558546
IncludeFooterProcessed = true;
559547
// Mark the footer file as included

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ if(SYCL_UR_USE_FETCH_CONTENT)
117117
endfunction()
118118

119119
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
120-
# commit e02d78ba74efd21219b18f4083cf9afc14a16759
121-
# Merge: e50a4ddc c12957bd
120+
# commit f8336050f43a6529636fd6b2075dfe09961564f5
121+
# Merge: 6c98e0e8 b75f2bc2
122122
# Author: Omar Ahmed <[email protected]>
123-
# Date: Fri Aug 9 15:41:55 2024 +0100
124-
# Merge pull request #1933 from nrspruit/fix_driver_version_check
125-
# [L0] Fix Driver Version check to use extension and tuple check
126-
set(UNIFIED_RUNTIME_TAG e02d78ba74efd21219b18f4083cf9afc14a16759)
123+
# Date: Tue Aug 13 13:07:23 2024 +0100
124+
# Merge pull request #1955 from nrspruit/fix_l0_coverity
125+
# [L0] fix Coverity issues for L0 Adapter
126+
set(UNIFIED_RUNTIME_TAG f8336050f43a6529636fd6b2075dfe09961564f5)
127127

128128
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
129129
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need

sycl/include/sycl/range.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ template <int Dimensions = 1> class range : public detail::array<Dimensions> {
5656
size_t size() const {
5757
size_t size = 1;
5858
for (int i = 0; i < Dimensions; ++i) {
59-
size *= this->get(i);
59+
size *= this->common_array[i];
6060
}
6161
return size;
6262
}

sycl/source/detail/event_impl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ void event_impl::waitInternal(bool *Success) {
8181
// Wait for connected events(e.g. streams prints)
8282
for (const EventImplPtr &Event : MPostCompleteEvents)
8383
Event->wait(Event);
84+
for (const std::weak_ptr<event_impl> &WeakEventPtr :
85+
MWeakPostCompleteEvents) {
86+
if (EventImplPtr Event = WeakEventPtr.lock())
87+
Event->wait(Event);
88+
}
8489
}
8590

8691
void event_impl::setComplete() {

sycl/source/detail/event_impl.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ class event_impl {
270270
MPostCompleteEvents.push_back(Event);
271271
}
272272

273+
void attachEventToCompleteWeak(const std::weak_ptr<event_impl> &Event) {
274+
std::lock_guard<std::mutex> Lock(MMutex);
275+
MWeakPostCompleteEvents.push_back(Event);
276+
}
277+
273278
bool isDefaultConstructed() const noexcept { return MIsDefaultConstructed; }
274279

275280
ContextImplPtr getContextImplPtr() {
@@ -358,6 +363,16 @@ class event_impl {
358363
std::vector<EventImplPtr> MPreparedHostDepsEvents;
359364

360365
std::vector<EventImplPtr> MPostCompleteEvents;
366+
// short term WA for stream:
367+
// MPostCompleteEvents is split into two storages now. Original storage is
368+
// used by graph extension and represents backward links.
369+
// MWeakPostCompleteEvents represents weak forward references (used in stream
370+
// only). Used only for host tasks now since they do not support post enqueue
371+
// cleanup and event == nullptr could happen only when host task is completed
372+
// (and Command that holding reference to its event is deleted). TO DO: to
373+
// eliminate forward references from stream implementation and remove this
374+
// storage.
375+
std::vector<std::weak_ptr<event_impl>> MWeakPostCompleteEvents;
361376

362377
/// Indicates that the task associated with this event has been submitted by
363378
/// the queue to the device.

sycl/source/detail/handler_impl.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ class handler_impl {
123123
bool MKernelUsesClusterLaunch = false;
124124

125125
// Extra information for bindless image copy
126-
ur_image_desc_t MSrcImageDesc;
127-
ur_image_desc_t MDstImageDesc;
128-
ur_image_format_t MSrcImageFormat;
129-
ur_image_format_t MDstImageFormat;
130-
ur_exp_image_copy_flags_t MImageCopyFlags;
131-
132-
ur_rect_offset_t MSrcOffset;
133-
ur_rect_offset_t MDestOffset;
134-
ur_rect_region_t MCopyExtent;
126+
ur_image_desc_t MSrcImageDesc = {};
127+
ur_image_desc_t MDstImageDesc = {};
128+
ur_image_format_t MSrcImageFormat = {};
129+
ur_image_format_t MDstImageFormat = {};
130+
ur_exp_image_copy_flags_t MImageCopyFlags = {};
131+
132+
ur_rect_offset_t MSrcOffset = {};
133+
ur_rect_offset_t MDestOffset = {};
134+
ur_rect_region_t MCopyExtent = {};
135135

136136
// Extra information for semaphore interoperability
137137
ur_exp_external_semaphore_handle_t MExternalSemaphore;

sycl/source/detail/queue_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ event queue_impl::submit_impl(const std::function<void(handler &)> &CGF,
396396
event FlushEvent = submit_impl(
397397
[&](handler &ServiceCGH) { Stream->generateFlushCommand(ServiceCGH); },
398398
Self, PrimaryQueue, SecondaryQueue, /*CallerNeedsEvent*/ true, Loc, {});
399-
EventImpl->attachEventToComplete(detail::getSyclObjImpl(FlushEvent));
399+
EventImpl->attachEventToCompleteWeak(detail::getSyclObjImpl(FlushEvent));
400400
registerStreamServiceEvent(detail::getSyclObjImpl(FlushEvent));
401401
}
402402

sycl/test-e2e/ESIMD/addc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
//===----------------------------------------------------------------------===//
88
// RUN: %{build} -o %t.out
99
// RUN: %{run} %t.out
10-
// https://github.com/intel/llvm/issues/14868
11-
// UNSUPPORTED: windows
1210

1311
// The test verifies ESIMD API that adds 2 32-bit integer scalars/vectors with
1412
// carry returning the result as 2 parts: carry flag the input modified operand
@@ -94,7 +92,7 @@ template <int N, bool AIsVector, bool BIsVector> bool test(sycl::queue Q) {
9492
}
9593

9694
} // end for BI
97-
} // end for AI
95+
} // end for AI
9896
}).wait();
9997
} catch (sycl::exception const &e) {
10098
std::cout << "SYCL exception caught: " << e.what() << '\n';

0 commit comments

Comments
 (0)