From 064386298bc2cc162f7ae405f3798799e8248035 Mon Sep 17 00:00:00 2001 From: Kseniya Tikhomirova Date: Mon, 18 Mar 2024 12:47:47 +0100 Subject: [PATCH] [SYCL][NFC] Fix warnings in queue_impl.* and device_binary_image.* (#13021) Signed-off-by: Tikhomirova, Kseniya --- sycl/source/detail/device_binary_image.cpp | 4 ++-- sycl/source/detail/device_binary_image.hpp | 2 +- sycl/source/detail/queue_impl.cpp | 4 ++-- sycl/source/detail/queue_impl.hpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sycl/source/detail/device_binary_image.cpp b/sycl/source/detail/device_binary_image.cpp index 1899fcd3db989..34bdebaaf08eb 100644 --- a/sycl/source/detail/device_binary_image.cpp +++ b/sycl/source/detail/device_binary_image.cpp @@ -153,6 +153,7 @@ RTDeviceBinaryImage::getProperty(const char *PropName) const { } void RTDeviceBinaryImage::init(pi_device_binary Bin) { + // Bin != nullptr is guaranteed here. this->Bin = Bin; // If device binary image format wasn't set by its producer, then can't change // now, because 'Bin' data is part of the executable image loaded into memory @@ -177,8 +178,7 @@ void RTDeviceBinaryImage::init(pi_device_binary Bin) { DeviceRequirements.init(Bin, __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS); HostPipes.init(Bin, __SYCL_PI_PROPERTY_SET_SYCL_HOST_PIPES); - if (Bin) - ImageId = ImageCounter++; + ImageId = ImageCounter++; } std::atomic RTDeviceBinaryImage::ImageCounter = 1; diff --git a/sycl/source/detail/device_binary_image.hpp b/sycl/source/detail/device_binary_image.hpp index d8974b4142071..28f34ea7ec404 100644 --- a/sycl/source/detail/device_binary_image.hpp +++ b/sycl/source/detail/device_binary_image.hpp @@ -243,7 +243,7 @@ class RTDeviceBinaryImage { private: static std::atomic ImageCounter; - uintptr_t ImageId; + uintptr_t ImageId = 0; }; // Dynamically allocated device binary image, which de-allocates its binary diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index f819b35053258..64a1fb5e888ac 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -342,7 +342,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr &Self, // If we have a command graph set we need to capture the op through the // handler rather than by-passing the scheduler. - if (!MGraph.lock() && + if (MGraph.expired() && areEventsSafeForSchedulerBypass(ExpandedDepEvents, MContext)) { if (MSupportsDiscardingPiEvents) { MemOpFunc(MemOpArgs..., getPIEvents(ExpandedDepEvents), @@ -360,7 +360,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr &Self, if (isInOrder()) { auto &EventToStoreIn = - MGraph.lock() ? MGraphLastEventPtr : MLastEventPtr; + MGraph.expired() ? MLastEventPtr : MGraphLastEventPtr; EventToStoreIn = EventImpl; } // Track only if we won't be able to handle it with piQueueFinish. diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index ad06891ebe568..7109555b05ecc 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -92,7 +92,7 @@ class queue_impl { /// \param PropList is a list of properties to use for queue construction. queue_impl(const DeviceImplPtr &Device, const async_handler &AsyncHandler, const property_list &PropList) - : queue_impl(Device, getDefaultOrNew(Device), AsyncHandler, PropList){}; + : queue_impl(Device, getDefaultOrNew(Device), AsyncHandler, PropList) {}; /// Constructs a SYCL queue with an async_handler and property_list provided /// form a device and a context. @@ -767,7 +767,7 @@ class queue_impl { // the RT but will not be passed to the backend. See getPIEvents in // Command. auto &EventToBuildDeps = - MGraph.lock() ? MGraphLastEventPtr : MLastEventPtr; + MGraph.expired() ? MLastEventPtr : MGraphLastEventPtr; if (EventToBuildDeps) Handler.depends_on( createSyclObjFromImpl(EventToBuildDeps));