Skip to content

Commit 7a90ab6

Browse files
committed
clean code
1 parent 611a872 commit 7a90ab6

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

source/loader/layers/sanitizer/asan_interceptor.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ ur_result_t enqueueMemSetShadow(ur_context_handle_t Context,
9797
}
9898
}
9999

100-
// context.logger.debug("urVirtualMemMap: {} ~ {}",
101-
// (void *)MappedPtr,
102-
// (void *)(MappedPtr + PageSize - 1));
100+
context.logger.debug("urVirtualMemMap: {} ~ {}",
101+
(void *)MappedPtr,
102+
(void *)(MappedPtr + PageSize - 1));
103103

104104
// FIXME: No flag to check the failed reason is VA is already mapped
105105
auto URes = context.urDdiTable.VirtualMem.pfnMap(
106106
Context, (void *)MappedPtr, PageSize, PhysicalMem, 0,
107107
UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE);
108-
// if (URes != UR_RESULT_SUCCESS) {
109-
// context.logger.debug("urVirtualMemMap(): {}", URes);
110-
// }
108+
if (URes != UR_RESULT_SUCCESS) {
109+
context.logger.debug("urVirtualMemMap(): {}", URes);
110+
}
111111

112112
// Initialize to zero
113113
if (URes == UR_RESULT_SUCCESS) {
@@ -173,7 +173,7 @@ SanitizerInterceptor::SanitizerInterceptor() {
173173
KV = Options->find("detect_locals");
174174
if (KV != Options->end()) {
175175
auto Value = KV->second.front();
176-
cl_DetectLocals = Value == "1" || Value == "true" ? 1 : 0;
176+
cl_DetectLocals = Value == "1" || Value == "true" ? true : false;
177177
}
178178
}
179179

@@ -576,7 +576,7 @@ SanitizerInterceptor::insertContext(ur_context_handle_t Context,
576576

577577
CI = std::make_shared<ContextInfo>(Context);
578578

579-
m_ContextMap.emplace(Context, CI);
579+
m_ContextMap.emplace(Context, std::move(CI));
580580

581581
return UR_RESULT_SUCCESS;
582582
}
@@ -612,7 +612,7 @@ SanitizerInterceptor::insertDevice(ur_device_handle_t Device,
612612
Device, UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN, sizeof(DI->Alignment),
613613
&DI->Alignment, nullptr));
614614

615-
m_DeviceMap.emplace(Device, DI);
615+
m_DeviceMap.emplace(Device, std::move(DI));
616616

617617
return UR_RESULT_SUCCESS;
618618
}

source/loader/layers/sanitizer/asan_libdevice.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ struct DeviceSanitizerReport {
6565
constexpr unsigned ASAN_SHADOW_SCALE = 3;
6666
constexpr unsigned ASAN_SHADOW_GRANULARITY = 1ULL << ASAN_SHADOW_SCALE;
6767

68-
// Based on the observation, only the last 24 bits of the address of the private
69-
// variable have changed, we use 31 bits(2G) to be safe.
70-
constexpr std::size_t ASAN_PRIVATE_SIZE = 0x7fffffffULL + 1;
71-
7268
// These magic values are written to shadow for better error
7369
// reporting.
7470
constexpr int kUsmDeviceRedzoneMagic = (char)0x81;

source/loader/layers/sanitizer/asan_quarantine.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class QuarantineCache {
4747
return It;
4848
}
4949

50-
void printStats() const {}
51-
5250
private:
5351
List m_List;
5452
std::atomic_uintptr_t m_Size = 0;

0 commit comments

Comments
 (0)