| 55 | } |
| 56 | |
| 57 | CUresult cuStreamGetIdFallback(CUstream stream, unsigned long long *id) |
| 58 | { |
| 59 | // If the stream handle is a pseudohandle, use some special treatment.... |
| 60 | if (stream == 0 || stream == CU_STREAM_LEGACY || stream == CU_STREAM_PER_THREAD) |
| 61 | { |
| 62 | int dev = -1; |
| 63 | if (cudaGetDevice(&dev) != cudaSuccess) |
| 64 | return CUDA_ERROR_INVALID_CONTEXT; |
| 65 | // If we use a per-thread stream, get TID; otherwise use -1 as a pseudo-tid |
| 66 | *id = MakeLegacyStreamId(dev, stream == CU_STREAM_PER_THREAD ? getTID() : -1); |
| 67 | return CUDA_SUCCESS; |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | // Otherwise just use the handle - it's not perfactly safe, but should do. |
| 72 | *id = (uint64_t)stream; |
| 73 | return CUDA_SUCCESS; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | cuStreamGetId_t *getRealStreamIdFunc() |
| 78 | { |
nothing calls this directly
no test coverage detected