Bad driver pointers

I was playing around some with the device API again today (still 2.2 on this machine), and after I added some new stuff to a program, I started getting back invalid device pointers from cuMemAlloc(). I’ve got a 512MB Geforce 8800 GT here, and the driver is (sometimes, but not always) returning a pointer of 536940544 (or 69632 bytes past the device’s memory).

Does that have something to do with Vista virtualizing the device memory? Or is it a bug in the driver?

EDIT: I was actually constructing a little program of my own for device<->host bandwidth testing, and I’m only allocating 64kb when this occurs.

and I assume cuMemAlloc is still returning CUDA_SUCCESS? what happens if you use these pointers in a function?

Yep. cuMemAlloc still gives CUDA_SUCCESS, and right after I allocate, I try to do a host->device transfer and it throws the following exception when I call cuMemcpyHtoD:

“AccessViolationException” was unhandled: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

It’s weird too, because it’s not failing every time, just sometimes.

EDIT: I just ran it again, and got the same exception, except this time the device pointer was 34078720 (under the 512MB limit).

Ah-hah! I figured it out…I wasn’t using one of my pointers properly and it was trying to read from some random part of host memory. Kind of weird that it said it was writing to somewhere in host memory when it was reading though…