@@ -179,47 +179,50 @@ class KernelProgramCache {
179179
180180 void setContextPtr (const ContextPtr &AContext) { MParentContext = AContext; }
181181
182- /* Sends message to std:cerr stream when SYCL_CACHE_TRACE environemnt is
183- * set.*/
182+ // Sends message to std:cerr stream when SYCL_CACHE_TRACE environemnt is
183+ // set.
184184 static inline void traceProgram (const std::string &Msg,
185185 const ProgramCacheKeyT &CacheKey) {
186186 static const bool traceEnabled =
187187 SYCLConfig<SYCL_CACHE_TRACE>::isTraceInMemCache ();
188- if (traceEnabled) {
189188
190- int ImageId = CacheKey.first .second ;
191- std::stringstream DeviceList;
192- for (const auto &Device : CacheKey.second )
193- DeviceList << " 0x" << std::setbase (16 )
194- << reinterpret_cast <uintptr_t >(Device) << " ," ;
189+ if (!traceEnabled)
190+ return ;
195191
196- std::string Identifier = " [Key:{imageId = " + std::to_string (ImageId) +
197- " ,urDevice = " + DeviceList.str () + " }]: " ;
192+ int ImageId = CacheKey.first .second ;
193+ std::stringstream DeviceList;
194+ for (const auto &Device : CacheKey.second )
195+ DeviceList << " 0x" << std::setbase (16 )
196+ << reinterpret_cast <uintptr_t >(Device) << " ," ;
198197
199- // Get TID of current thread.
200- thread_local std::thread::id this_id = std::this_thread::get_id ();
201- std::cerr << " [In-Memory Cache][Thread Id:" << this_id
202- << " ][Program Cache]" << Identifier << Msg << std::endl;
203- }
198+ std::string Identifier = " [Key:{imageId = " + std::to_string (ImageId) +
199+ " ,urDevice = " + DeviceList.str () + " }]: " ;
200+
201+ // Get TID of current thread.
202+ thread_local std::thread::id this_id = std::this_thread::get_id ();
203+ std::cerr << " [In-Memory Cache][Thread Id:" << this_id << " ][Program Cache]"
204+ << Identifier << Msg << std::endl;
204205 }
205206
206- /* Sends message to std:cerr stream when SYCL_CACHE_TRACE environemnt is
207- * set.*/
207+ // Sends message to std:cerr stream when SYCL_CACHE_TRACE environemnt is
208+ // set.
208209 static inline void traceKernel (const std::string &Msg,
209210 const std::string &KernelName,
210211 bool IsKernelFastCache = false ) {
211212 static const bool traceEnabled =
212213 SYCLConfig<SYCL_CACHE_TRACE>::isTraceInMemCache ();
213- if (traceEnabled) {
214- std::string Identifier =
215- " [IsFastCache: " + std::to_string (IsKernelFastCache) +
216- " ][Key:{Name = " + KernelName + " }]: " ;
217-
218- // Get TID of current thread.
219- thread_local std::thread::id this_id = std::this_thread::get_id ();
220- std::cerr << " [In-Memory Cache][Thread Id:" << this_id
221- << " ][Kernel Cache]" << Identifier << Msg << std::endl;
222- }
214+
215+ if (!traceEnabled)
216+ return ;
217+
218+ std::string Identifier =
219+ " [IsFastCache: " + std::to_string (IsKernelFastCache) +
220+ " ][Key:{Name = " + KernelName + " }]: " ;
221+
222+ // Get TID of current thread.
223+ thread_local std::thread::id this_id = std::this_thread::get_id ();
224+ std::cerr << " [In-Memory Cache][Thread Id:" << this_id << " ][Kernel Cache]"
225+ << Identifier << Msg << std::endl;
223226 }
224227
225228 Locked<ProgramCache> acquireCachedPrograms () {
0 commit comments