CUDA virtual memory management API

I have a question regarding the CUDA virtual memory management APIs.

I marked a page of memory obtained through VirtualAlloc with PAGE_GUARD, and passed that to cudaHostRegister. I then tried to write to this memory from a kernel, but STATUS_GUARD_PAGE_VIOLATION does not get triggered. It does trigger when the host writes to it.

Is this because the writes are managed by the kernel mode driver, and they can bypass this protection?

Those aren’t part of the CUDA virtual memory management APIs.

I don’t know the answer to your question. I think it is certainly an atypical way to use cudaHostRegister.

True, yep. I was trying to understand how these pointers work under the hood!

You mean to say, passing a pointer obtained from VirualAlloc to cudaHostRegister is incorrect, or that my flags are incorrect?

Any advice would be appreciated!

The typical way to use cudaHostRegister is on a pointer that has been allocated by malloc or new.

Yes, but unless I’m mistaken, aren’t those regions, on windows, allocated using VirtualAlloc.

Basically I’m trying to trigger debugger-like exception within the application. The exception is triggered when a different thread writes to the protected region, but not when a kernel writes to it. I was wondering if I was misunderstanding something.

Thank you for your time!