Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions source/loader/layers/sanitizer/asan_shadow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,9 @@ ur_result_t ShadowMemoryGPU::ReleaseShadow(std::shared_ptr<AllocInfo> AI) {
}

uptr ShadowMemoryPVC::MemToShadow(uptr Ptr) {
if (Ptr & 0xFF00000000000000ULL) { // Device USM
return ShadowBegin + 0x80000000000ULL +
((Ptr & 0xFFFFFFFFFFFFULL) >> ASAN_SHADOW_SCALE);
} else { // Only consider 47bit VA
return ShadowBegin + ((Ptr & 0x7FFFFFFFFFFFULL) >> ASAN_SHADOW_SCALE);
}
return ShadowBegin + (((((Ptr & 0x8000'0000'0000'0000) >> 16) + Ptr) &
0xf'ffff'ffff'ffff) >>
ASAN_SHADOW_SCALE);
}

uptr ShadowMemoryDG2::MemToShadow(uptr Ptr) {
Expand Down
6 changes: 6 additions & 0 deletions source/loader/layers/sanitizer/ur_sanddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet(
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

// Set env AllocateHostAllocationsInHeapExtendedHost to 0, then host and
// shared usm will have same allocation range on GPU device. This will
// simplify shadow memory mapping logic on GPU device.
setenv("NEOReadDebugKeys", "1", 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nrspruit is it a good idea to set these env variables in the layer? If this is really required, wouldn't it be a better idea to make this into an L0 API?
Using a debug key for functionality doesn't seem like a good idea.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel comfortable merging this patch. We need confirmation from the NEO folks that this makes sense.
@MichalMrozek can you help?

Copy link
Contributor

@MichalMrozek MichalMrozek Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not correct to set this.
Please do not merge it.
If you want to have specific release keys avaialable this needs discussion with driver team.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AllocateHostAllocationsInHeapExtendedHost is a debug key, debug keys cannot be used in production software. They are meant only for experiments. Driver team may remove or change this debug variable at any point of time without any notifications.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will send this request to driver team. Thanks.

setenv("AllocateHostAllocationsInHeapExtendedHost", "0", 1);

ur_result_t result = pfnAdapterGet(NumEntries, phAdapters, pNumAdapters);
if (result == UR_RESULT_SUCCESS && phAdapters) {
const uint32_t NumAdapters = pNumAdapters ? *pNumAdapters : NumEntries;
Expand Down
Loading