Skip to content

Commit 14dc5ac

Browse files
committed
Address reviews. Remove null check.
1 parent 1914331 commit 14dc5ac

File tree

2 files changed

+22
-27
lines changed

2 files changed

+22
-27
lines changed

sycl/source/detail/handler_impl.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ enum class HandlerSubmissionState : std::uint8_t {
3131

3232
class handler_impl {
3333
public:
34-
handler_impl(
35-
std::shared_ptr<queue_impl> SubmissionPrimaryQueue,
36-
[[maybe_unused]] std::shared_ptr<queue_impl> SubmissionSecondaryQueue,
37-
bool EventNeeded)
34+
handler_impl(std::shared_ptr<queue_impl> SubmissionPrimaryQueue,
35+
bool EventNeeded)
3836
: MSubmissionPrimaryQueue(std::move(SubmissionPrimaryQueue)),
3937
MEventNeeded(EventNeeded) {};
4038

sycl/source/handler.cpp

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,12 @@ handler::handler(std::shared_ptr<detail::queue_impl> Queue,
316316
bool CallerNeedsEvent)
317317
: handler(Queue, Queue, nullptr, CallerNeedsEvent) {}
318318

319-
handler::handler(std::shared_ptr<detail::queue_impl> Queue,
320-
std::shared_ptr<detail::queue_impl> PrimaryQueue,
321-
std::shared_ptr<detail::queue_impl> SecondaryQueue,
322-
bool CallerNeedsEvent)
319+
handler::handler(
320+
std::shared_ptr<detail::queue_impl> Queue,
321+
std::shared_ptr<detail::queue_impl> PrimaryQueue,
322+
[[maybe_unused]] std::shared_ptr<detail::queue_impl> SecondaryQueue,
323+
bool CallerNeedsEvent)
323324
: impl(std::make_shared<detail::handler_impl>(std::move(PrimaryQueue),
324-
std::move(SecondaryQueue),
325325
CallerNeedsEvent)),
326326
MQueue(std::move(Queue)) {}
327327

@@ -1908,30 +1908,27 @@ void handler::verifyDeviceHasProgressGuarantee(
19081908
}
19091909

19101910
bool handler::supportsUSMMemcpy2D() {
1911-
auto &QueueImpl = impl->MSubmissionPrimaryQueue;
1912-
if (QueueImpl && !checkContextSupports(QueueImpl->getContextImplPtr(),
1913-
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT))
1914-
return false;
1915-
1916-
return true;
1911+
assert(impl->MSubmissionPrimaryQueue &&
1912+
"handler should not have a null primary queue.");
1913+
return checkContextSupports(
1914+
impl->MSubmissionPrimaryQueue->getContextImplPtr(),
1915+
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT);
19171916
}
19181917

19191918
bool handler::supportsUSMFill2D() {
1920-
auto &QueueImpl = impl->MSubmissionPrimaryQueue;
1921-
if (QueueImpl && !checkContextSupports(QueueImpl->getContextImplPtr(),
1922-
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT))
1923-
return false;
1924-
1925-
return true;
1919+
assert(impl->MSubmissionPrimaryQueue &&
1920+
"handler should not have a null primary queue.");
1921+
return checkContextSupports(
1922+
impl->MSubmissionPrimaryQueue->getContextImplPtr(),
1923+
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT);
19261924
}
19271925

19281926
bool handler::supportsUSMMemset2D() {
1929-
auto &QueueImpl = impl->MSubmissionPrimaryQueue;
1930-
if (QueueImpl && !checkContextSupports(QueueImpl->getContextImplPtr(),
1931-
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT))
1932-
return false;
1933-
1934-
return true;
1927+
assert(impl->MSubmissionPrimaryQueue &&
1928+
"handler should not have a null primary queue.");
1929+
return checkContextSupports(
1930+
impl->MSubmissionPrimaryQueue->getContextImplPtr(),
1931+
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT);
19351932
}
19361933

19371934
id<2> handler::computeFallbackKernelBounds(size_t Width, size_t Height) {

0 commit comments

Comments
 (0)