@@ -155,6 +155,8 @@ RetT *waitUntilBuilt(KernelProgramCache &Cache,
155
155
// / locked version. Accepts reference to locked version of cache.
156
156
// / \tparam BuildFT type of function which will build the entity if it is not in
157
157
// / cache. Accepts nothing. Return pointer to built entity.
158
+ // /
159
+ // / \return a pointer to cached build result, return value must not be nullptr.
158
160
template <typename RetT, typename ExceptionT, typename KeyT, typename AcquireFT,
159
161
typename GetCacheFT, typename BuildFT>
160
162
KernelProgramCache::BuildResult<RetT> *
@@ -528,6 +530,7 @@ RT::PiProgram ProgramManager::getBuiltPIProgram(
528
530
std::make_pair (std::make_pair (std::move (SpecConsts), KSId),
529
531
std::make_pair (PiDevice, CompileOpts + LinkOpts)),
530
532
AcquireF, GetF, BuildF);
533
+ // getOrBuild is not supposed to return nullptr
531
534
assert (BuildResult != nullptr && " Invalid build result" );
532
535
return BuildResult->Ptr .load ();
533
536
}
@@ -594,6 +597,7 @@ ProgramManager::getOrCreateKernel(OSModuleHandle M,
594
597
595
598
auto BuildResult = getOrBuild<PiKernelT, invalid_object_error>(
596
599
Cache, KernelName, AcquireF, GetF, BuildF);
600
+ // getOrBuild is not supposed to return nullptr
597
601
assert (BuildResult != nullptr && " Invalid build result" );
598
602
auto ret_val = std::make_tuple (BuildResult->Ptr .load (),
599
603
&(BuildResult->MBuildResultMutex ), Program);
@@ -1795,6 +1799,7 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
1795
1799
std::make_pair (std::make_pair (std::move (SpecConsts), (size_t )ImgPtr),
1796
1800
std::make_pair (PiDevice, CompileOpts + LinkOpts)),
1797
1801
AcquireF, GetF, BuildF);
1802
+ // getOrBuild is not supposed to return nullptr
1798
1803
assert (BuildResult != nullptr && " Invalid build result" );
1799
1804
1800
1805
RT::PiProgram ResProgram = BuildResult->Ptr .load ();
@@ -1815,6 +1820,7 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
1815
1820
std::make_pair (std::make_pair (std::move (SpecConsts), (size_t )ImgPtr),
1816
1821
std::make_pair (PiDeviceAdd, CompileOpts + LinkOpts)),
1817
1822
AcquireF, GetF, CacheOtherDevices);
1823
+ // getOrBuild is not supposed to return nullptr
1818
1824
assert (BuildResult != nullptr && " Invalid build result" );
1819
1825
}
1820
1826
@@ -1869,6 +1875,7 @@ std::pair<RT::PiKernel, std::mutex *> ProgramManager::getOrCreateKernel(
1869
1875
1870
1876
auto BuildResult = getOrBuild<PiKernelT, invalid_object_error>(
1871
1877
Cache, KernelName, AcquireF, GetF, BuildF);
1878
+ // getOrBuild is not supposed to return nullptr
1872
1879
assert (BuildResult != nullptr && " Invalid build result" );
1873
1880
return std::make_pair (BuildResult->Ptr .load (),
1874
1881
&(BuildResult->MBuildResultMutex ));
0 commit comments