NVIDIA/compute-sanitizer-samples

A bug in sanitizer api

Closed this issue · 4 comments

Hi,

I found Sanitizer_ResourceMemoryData::flags == 0x6 rather than 0x2 if the allocation is managed memory, my cuda version 12.1.

Hi @achartier , I've created a repository to reproduce the bug with the callback for cudaMallocManaged. Could you please check it out?
https://github.com/Lin-Mao/sanitizer-api-bug

Assigning to @aladram

Hi @aladram @achartier, I am wondering if there's any update about this bug.

Thank you Lin for the ping, this is expected as these flags are not mutually exclusive. 0x6 means both 0x2 and 0x4, i.e. both SANITIZER_MEMORY_FLAG_MANAGED and SANITIZER_MEMORY_FLAG_HOST_MAPPED. If you want to check if an allocation is managed, you can check for the flag using a binary AND, see example below:

bool isAllocationManaged = flags & SANITIZER_MEMORY_FLAG_MANAGED;

Please let me know if you have any additional questions, marking as closed for now,