@@ -48,6 +48,7 @@ class KernelProgramCache {
4848 // / Currently there is only a single user - ProgramManager class.
4949 template <typename T> struct BuildResult {
5050 std::atomic<T *> Ptr;
51+ T Val;
5152 std::atomic<BuildState> State;
5253 BuildError Error;
5354
@@ -68,9 +69,7 @@ class KernelProgramCache {
6869 BuildResult (T *P, BuildState S) : Ptr{P}, State{S}, Error{" " , 0 } {}
6970 };
7071
71- using PiProgramT = std::remove_pointer<RT::PiProgram>::type;
72- using PiProgramPtrT = std::atomic<PiProgramT *>;
73- using ProgramWithBuildStateT = BuildResult<PiProgramT>;
72+ using ProgramWithBuildStateT = BuildResult<RT::PiProgram>;
7473 using ProgramCacheKeyT = std::pair<std::pair<SerializedObj, std::uintptr_t >,
7574 std::pair<RT::PiDevice, std::string>>;
7675 using CommonProgramKeyT = std::pair<std::uintptr_t , RT::PiDevice>;
@@ -84,18 +83,15 @@ class KernelProgramCache {
8483
8584 using ContextPtr = context_impl *;
8685
87- using PiKernelT = std::remove_pointer<RT::PiKernel>::type;
88-
89- using PiKernelPtrT = std::atomic<PiKernelT *>;
90- using KernelWithBuildStateT = BuildResult<PiKernelT>;
91- using KernelByNameT = std::map<std::string, KernelWithBuildStateT>;
86+ using KernelArgMaskPairT = std::pair<RT::PiKernel, const KernelArgMask *>;
87+ using KernelByNameT = std::map<std::string, BuildResult<KernelArgMaskPairT>>;
9288 using KernelCacheT = std::map<RT::PiProgram, KernelByNameT>;
9389
9490 using KernelFastCacheKeyT =
9591 std::tuple<SerializedObj, OSModuleHandle, RT::PiDevice, std::string,
9692 std::string>;
97- using KernelFastCacheValT =
98- std::tuple<RT::PiKernel, std::mutex *, RT::PiProgram>;
93+ using KernelFastCacheValT = std::tuple<RT::PiKernel, std::mutex *,
94+ const KernelArgMask *, RT::PiProgram>;
9995 using KernelFastCacheT = std::map<KernelFastCacheKeyT, KernelFastCacheValT>;
10096
10197 ~KernelProgramCache ();
@@ -128,7 +124,7 @@ class KernelProgramCache {
128124 return std::make_pair (&Inserted.first ->second , Inserted.second );
129125 }
130126
131- std::pair<KernelWithBuildStateT *, bool >
127+ std::pair<BuildResult<KernelArgMaskPairT> *, bool >
132128 getOrInsertKernel (RT::PiProgram Program, const std::string &KernelName) {
133129 auto LockedCache = acquireKernelsPerProgramCache ();
134130 auto &Cache = LockedCache.get ()[Program];
@@ -173,7 +169,7 @@ class KernelProgramCache {
173169 if (It != MKernelFastCache.end ()) {
174170 return It->second ;
175171 }
176- return std::make_tuple (nullptr , nullptr , nullptr );
172+ return std::make_tuple (nullptr , nullptr , nullptr , nullptr );
177173 }
178174
179175 template <typename KeyT, typename ValT>
0 commit comments