problem with DX9

In my program, I use cudaD3D9RegisterResource to register a Vertexbuffer Created by dx9. but it return a error. Sometimes it return CUDA_ERROR_UNKNOWN error, but Sometimes it return cudaErrorPriorLaunchFailure error.
But the SimpleD3D9 have no problem. I didn’t know why.

I Know the reason of CUDA_ERROR_UNKNOWN. Because when I created vertexBuffer, I use D3DUSAGE_DYNAMIC, and I lock the buffer with D3DLOCK_DISCARD. when i change D3DUSAGE_DYNAMIC into ‘0’,CUDA_ERROR_UNKNOWN disappear.but cudaErrorPriorLaunchFailure isn’t soloved