Skip to content

Commit eeb6b3b

Browse files
committed
[DeviceSanitizer] Remove device global "__AsanDeviceGlobalCount"
Now UR already implemented API "urProgramGetGlobalVariablePointer", so we can use it to query the size of device globals. After that, we can remove "__AsanDeviceGlobalCount".
1 parent fcd3693 commit eeb6b3b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

source/loader/layers/sanitizer/asan_interceptor.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -522,16 +522,18 @@ SanitizerInterceptor::registerDeviceGlobals(ur_context_handle_t Context,
522522
for (auto Device : Devices) {
523523
ManagedQueue Queue(Context, Device);
524524

525-
uint64_t NumOfDeviceGlobal;
526-
auto Result = context.urDdiTable.Enqueue.pfnDeviceGlobalVariableRead(
527-
Queue, Program, kSPIR_AsanDeviceGlobalCount, true,
528-
sizeof(NumOfDeviceGlobal), 0, &NumOfDeviceGlobal, 0, nullptr,
529-
nullptr);
525+
[[maybe_unused]] size_t MetadataSize;
526+
[[maybe_unused]] void *MetadataPtr;
527+
auto Result = context.urDdiTable.Program.pfnGetGlobalVariablePointer(
528+
Device, Program, kSPIR_AsanDeviceGlobalMetadata, &MetadataSize,
529+
&MetadataPtr);
530530
if (Result != UR_RESULT_SUCCESS) {
531531
context.logger.info("No device globals");
532532
continue;
533533
}
534534

535+
const uint64_t NumOfDeviceGlobal =
536+
MetadataSize / sizeof(DeviceGlobalInfo);
535537
std::vector<DeviceGlobalInfo> GVInfos(NumOfDeviceGlobal);
536538
Result = context.urDdiTable.Enqueue.pfnDeviceGlobalVariableRead(
537539
Queue, Program, kSPIR_AsanDeviceGlobalMetadata, true,

source/loader/layers/sanitizer/asan_libdevice.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ constexpr auto kSPIR_AsanShadowMemoryGlobalEnd = "__AsanShadowMemoryGlobalEnd";
9393
constexpr auto kSPIR_DeviceType = "__DeviceType";
9494
constexpr auto kSPIR_AsanDebug = "__AsanDebug";
9595

96-
constexpr auto kSPIR_AsanDeviceGlobalCount = "__AsanDeviceGlobalCount";
9796
constexpr auto kSPIR_AsanDeviceGlobalMetadata = "__AsanDeviceGlobalMetadata";
9897

9998
inline const char *ToString(DeviceSanitizerMemoryType MemoryType) {

0 commit comments

Comments
 (0)