Skip to content

Commit dcb022f

Browse files
zhaomaosukbenzie
authored andcommitted
Support device memory sanitizer for DG2 GPU device (#16619)
1 parent 3a1b93e commit dcb022f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

source/loader/layers/sanitizer/msan/msan_shadow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ ur_result_t MsanShadowMemoryGPU::Setup() {
141141
// To reserve very large amount of GPU virtual memroy, the pStart param
142142
// should be beyond the SVM range, so that GFX driver will automatically
143143
// switch to reservation on the GPU heap.
144-
const void *StartAddress = (void *)(0x100'0000'0000'0000ULL);
144+
const void *StartAddress = (void *)GetStartAddress();
145145
// TODO: Protect Bad Zone
146146
auto Result = getContext()->urDdiTable.VirtualMem.pfnReserve(
147147
Context, StartAddress, ShadowSize, (void **)&ShadowBegin);

source/loader/layers/sanitizer/msan/msan_shadow.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ struct MsanShadowMemoryGPU : public MsanShadowMemory {
103103

104104
virtual size_t GetShadowSize() = 0;
105105

106+
virtual uptr GetStartAddress() { return 0; }
107+
106108
private:
107109
ur_result_t EnqueueMapShadow(ur_queue_handle_t Queue, uptr Ptr, uptr Size,
108110
std::vector<ur_event_handle_t> &EventWaitList,
@@ -134,6 +136,8 @@ struct MsanShadowMemoryPVC final : public MsanShadowMemoryGPU {
134136
uptr MemToShadow(uptr Ptr) override;
135137

136138
size_t GetShadowSize() override { return 0x8000'0000'0000ULL; }
139+
140+
uptr GetStartAddress() override { return 0x100'0000'0000'0000ULL; }
137141
};
138142

139143
/// Shadow Memory layout of GPU DG2 device

0 commit comments

Comments
 (0)