Skip to content

Commit 24163e0

Browse files
author
Alexander Batashev
committed
add comment
1 parent 155322f commit 24163e0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ RetT *waitUntilBuilt(KernelProgramCache &Cache,
155155
/// locked version. Accepts reference to locked version of cache.
156156
/// \tparam BuildFT type of function which will build the entity if it is not in
157157
/// cache. Accepts nothing. Return pointer to built entity.
158+
///
159+
/// \return a pointer to cached build result, return value must not be nullptr.
158160
template <typename RetT, typename ExceptionT, typename KeyT, typename AcquireFT,
159161
typename GetCacheFT, typename BuildFT>
160162
KernelProgramCache::BuildResult<RetT> *
@@ -528,6 +530,7 @@ RT::PiProgram ProgramManager::getBuiltPIProgram(
528530
std::make_pair(std::make_pair(std::move(SpecConsts), KSId),
529531
std::make_pair(PiDevice, CompileOpts + LinkOpts)),
530532
AcquireF, GetF, BuildF);
533+
// getOrBuild is not supposed to return nullptr
531534
assert(BuildResult != nullptr && "Invalid build result");
532535
return BuildResult->Ptr.load();
533536
}
@@ -594,6 +597,7 @@ ProgramManager::getOrCreateKernel(OSModuleHandle M,
594597

595598
auto BuildResult = getOrBuild<PiKernelT, invalid_object_error>(
596599
Cache, KernelName, AcquireF, GetF, BuildF);
600+
// getOrBuild is not supposed to return nullptr
597601
assert(BuildResult != nullptr && "Invalid build result");
598602
auto ret_val = std::make_tuple(BuildResult->Ptr.load(),
599603
&(BuildResult->MBuildResultMutex), Program);
@@ -1795,6 +1799,7 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
17951799
std::make_pair(std::make_pair(std::move(SpecConsts), (size_t)ImgPtr),
17961800
std::make_pair(PiDevice, CompileOpts + LinkOpts)),
17971801
AcquireF, GetF, BuildF);
1802+
// getOrBuild is not supposed to return nullptr
17981803
assert(BuildResult != nullptr && "Invalid build result");
17991804

18001805
RT::PiProgram ResProgram = BuildResult->Ptr.load();
@@ -1815,6 +1820,7 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
18151820
std::make_pair(std::make_pair(std::move(SpecConsts), (size_t)ImgPtr),
18161821
std::make_pair(PiDeviceAdd, CompileOpts + LinkOpts)),
18171822
AcquireF, GetF, CacheOtherDevices);
1823+
// getOrBuild is not supposed to return nullptr
18181824
assert(BuildResult != nullptr && "Invalid build result");
18191825
}
18201826

@@ -1869,6 +1875,7 @@ std::pair<RT::PiKernel, std::mutex *> ProgramManager::getOrCreateKernel(
18691875

18701876
auto BuildResult = getOrBuild<PiKernelT, invalid_object_error>(
18711877
Cache, KernelName, AcquireF, GetF, BuildF);
1878+
// getOrBuild is not supposed to return nullptr
18721879
assert(BuildResult != nullptr && "Invalid build result");
18731880
return std::make_pair(BuildResult->Ptr.load(),
18741881
&(BuildResult->MBuildResultMutex));

0 commit comments

Comments
 (0)