@@ -146,10 +146,12 @@ ur_result_t enqueueMemSetShadow(ur_context_handle_t Context,
146146
147147} // namespace
148148
149- SanitizerInterceptor::SanitizerInterceptor () {
150- if (Options ().MaxQuarantineSizeMB ) {
149+ SanitizerInterceptor::SanitizerInterceptor (logger::Logger &logger)
150+ : logger(logger) {
151+ if (Options (logger).MaxQuarantineSizeMB ) {
151152 m_Quarantine = std::make_unique<Quarantine>(
152- static_cast <uint64_t >(Options ().MaxQuarantineSizeMB ) * 1024 * 1024 );
153+ static_cast <uint64_t >(Options (logger).MaxQuarantineSizeMB ) * 1024 *
154+ 1024 );
153155 }
154156}
155157
@@ -189,7 +191,8 @@ ur_result_t SanitizerInterceptor::allocateMemory(
189191 Alignment = MinAlignment;
190192 }
191193
192- uptr RZLog = ComputeRZLog (Size, Options ().MinRZSize , Options ().MaxRZSize );
194+ uptr RZLog = ComputeRZLog (Size, Options (logger).MinRZSize ,
195+ Options (logger).MaxRZSize );
193196 uptr RZSize = RZLog2Size (RZLog);
194197 uptr RoundedSize = RoundUpTo (Size, Alignment);
195198 uptr NeededSize = RoundedSize + RZSize * 2 ;
@@ -706,7 +709,7 @@ ur_result_t SanitizerInterceptor::prepareLaunch(
706709
707710 // Write debug
708711 // We use "uint64_t" here because EnqueueWriteGlobal will fail when it's "uint32_t"
709- uint64_t Debug = Options ().Debug ? 1 : 0 ;
712+ uint64_t Debug = Options (logger ).Debug ? 1 : 0 ;
710713 EnqueueWriteGlobal (kSPIR_AsanDebug , &Debug, sizeof (Debug));
711714
712715 // Write shadow memory offset for global memory
@@ -779,7 +782,7 @@ ur_result_t SanitizerInterceptor::prepareLaunch(
779782 LocalMemoryUsage, PrivateMemoryUsage);
780783
781784 // Write shadow memory offset for local memory
782- if (Options ().DetectLocals ) {
785+ if (Options (logger ).DetectLocals ) {
783786 // CPU needn't this
784787 if (DeviceInfo->Type == DeviceType::GPU_PVC) {
785788 const size_t LocalMemorySize =
@@ -818,7 +821,7 @@ ur_result_t SanitizerInterceptor::prepareLaunch(
818821 }
819822
820823 // Write shadow memory offset for private memory
821- if (Options ().DetectPrivates ) {
824+ if (Options (logger ).DetectPrivates ) {
822825 if (DeviceInfo->Type == DeviceType::CPU) {
823826 LaunchInfo.Data ->PrivateShadowOffset = DeviceInfo->ShadowOffset ;
824827 } else if (DeviceInfo->Type == DeviceType::GPU_PVC) {
0 commit comments