Skip to content
Merged
12 changes: 7 additions & 5 deletions source/loader/layers/sanitizer/asan_interceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,16 +522,18 @@ SanitizerInterceptor::registerDeviceGlobals(ur_context_handle_t Context,
for (auto Device : Devices) {
ManagedQueue Queue(Context, Device);

uint64_t NumOfDeviceGlobal;
auto Result = context.urDdiTable.Enqueue.pfnDeviceGlobalVariableRead(
Queue, Program, kSPIR_AsanDeviceGlobalCount, true,
sizeof(NumOfDeviceGlobal), 0, &NumOfDeviceGlobal, 0, nullptr,
nullptr);
[[maybe_unused]] size_t MetadataSize;
[[maybe_unused]] void *MetadataPtr;
auto Result = context.urDdiTable.Program.pfnGetGlobalVariablePointer(
Device, Program, kSPIR_AsanDeviceGlobalMetadata, &MetadataSize,
&MetadataPtr);
if (Result != UR_RESULT_SUCCESS) {
context.logger.info("No device globals");
continue;
}

const uint64_t NumOfDeviceGlobal =
MetadataSize / sizeof(DeviceGlobalInfo);
std::vector<DeviceGlobalInfo> GVInfos(NumOfDeviceGlobal);
Result = context.urDdiTable.Enqueue.pfnDeviceGlobalVariableRead(
Queue, Program, kSPIR_AsanDeviceGlobalMetadata, true,
Expand Down
1 change: 0 additions & 1 deletion source/loader/layers/sanitizer/asan_libdevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ constexpr auto kSPIR_AsanShadowMemoryGlobalEnd = "__AsanShadowMemoryGlobalEnd";
constexpr auto kSPIR_DeviceType = "__DeviceType";
constexpr auto kSPIR_AsanDebug = "__AsanDebug";

constexpr auto kSPIR_AsanDeviceGlobalCount = "__AsanDeviceGlobalCount";
constexpr auto kSPIR_AsanDeviceGlobalMetadata = "__AsanDeviceGlobalMetadata";

inline const char *ToString(DeviceSanitizerMemoryType MemoryType) {
Expand Down