Skip to content

Commit eb8f4f5

Browse files
author
Sergey Kanaev
committed
[SYCL] Fix review comments
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent 2985a52 commit eb8f4f5

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

sycl/include/CL/sycl/detail/kernel_program_cache.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,25 @@ class KernelProgramCache {
3535
/// State of the entity is provided by the user of cache instance.
3636
/// Currently there is only a single user - ProgramManager class.
3737
template<typename T>
38-
struct EntityWithState {
38+
struct EntityWithBuildResult {
3939
std::atomic<T *> Ptr;
4040
std::atomic<int> State;
4141
std::unique_ptr<BuildResultT> BuildResult;
4242

43-
EntityWithState(T* P, int S)
43+
EntityWithBuildResult(T* P, int S)
4444
: Ptr{P}, State{S}
4545
{}
4646
};
4747

4848
using PiProgramT = std::remove_pointer<RT::PiProgram>::type;
4949
using PiProgramPtrT = std::atomic<PiProgramT *>;
50-
using ProgramWithBuildStateT = EntityWithState<PiProgramT>;
50+
using ProgramWithBuildStateT = EntityWithBuildResult<PiProgramT>;
5151
using ProgramCacheT = std::map<OSModuleHandle, ProgramWithBuildStateT>;
5252
using ContextPtr = context_impl *;
5353

5454
using PiKernelT = std::remove_pointer<RT::PiKernel>::type;
5555
using PiKernelPtrT = std::atomic<PiKernelT *>;
56-
using KernelWithBuildStateT = EntityWithState<PiKernelT>;
56+
using KernelWithBuildStateT = EntityWithBuildResult<PiKernelT>;
5757
using KernelByNameT = std::map<string_class, KernelWithBuildStateT>;
5858
using KernelCacheT = std::map<RT::PiProgram, KernelByNameT>;
5959

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ DeviceImage &ProgramManager::getDeviceImage(OSModuleHandle M,
110110
}
111111

112112
template <typename ExceptionT, typename RetT>
113-
RetT *
114-
waitUntilBuilt(KernelProgramCache &Cache,
115-
KernelProgramCache::EntityWithState<RetT> *WithBuildState) {
113+
RetT *waitUntilBuilt(
114+
KernelProgramCache &Cache,
115+
KernelProgramCache::EntityWithBuildResult<RetT> *WithBuildState) {
116116
// any thread which will find nullptr in cache will wait until the pointer
117117
// is not null anymore
118118
Cache.waitUntilBuilt([WithBuildState]() {
@@ -129,8 +129,7 @@ waitUntilBuilt(KernelProgramCache &Cache,
129129

130130
RetT *Result = WithBuildState->Ptr.load();
131131

132-
if (!Result)
133-
throw ExceptionT("Build of the program/kernel did not succeed previously.");
132+
assert(Result && "An exception should have been thrown");
134133

135134
return Result;
136135
}
@@ -157,7 +156,7 @@ template <typename RetT, typename ExceptionT, typename KeyT, typename AcquireFT,
157156
RetT *getOrBuild(KernelProgramCache &KPCache, const KeyT &CacheKey,
158157
AcquireFT &&Acquire, GetCacheFT &&GetCache, BuildFT &&Build) {
159158
bool InsertionTookPlace;
160-
KernelProgramCache::EntityWithState<RetT> *WithState;
159+
KernelProgramCache::EntityWithBuildResult<RetT> *WithState;
161160

162161
{
163162
auto LockedCache = Acquire(KPCache);

0 commit comments

Comments
 (0)