diff --git a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu index c40c607396f3f..d5b01bfa34833 100644 --- a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu +++ b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu @@ -621,21 +621,10 @@ void GPUReconstructionCUDA::loadKernelModules(bool perKernel) } } -#ifndef __HIPCC__ // CUDA -void GPUReconstructionCUDA::startGPUProfiling() -{ - GPUChkErr(cudaProfilerStart()); -} - -void GPUReconstructionCUDA::endGPUProfiling() -{ - GPUChkErr(cudaProfilerStop()); -} - void GPUReconstructionCUDA::SetONNXGPUStream(Ort::SessionOptions& session_options, int32_t stream, int32_t* deviceId) { -#ifdef ORT_CUDA_BUILD - cudaGetDevice(deviceId); + GPUChkErr(cudaGetDevice(deviceId)); +#if !defined(__HIPCC__) && defined(ORT_CUDA_BUILD) OrtCUDAProviderOptionsV2* cuda_options = nullptr; CreateCUDAProviderOptions(&cuda_options); @@ -650,22 +639,7 @@ void GPUReconstructionCUDA::SetONNXGPUStream(Ort::SessionOptions& session_option // Finally, don't forget to release the provider options ReleaseCUDAProviderOptions(cuda_options); -#endif // ORT_CUDA_BUILD -} - -#else // HIP -void* GPUReconstructionHIP::getGPUPointer(void* ptr) -{ - void* retVal = nullptr; - GPUChkErr(hipHostGetDevicePointer(&retVal, ptr, 0)); - return retVal; -} - -void GPUReconstructionHIP::SetONNXGPUStream(Ort::SessionOptions& session_options, int32_t stream, int32_t* deviceId) -{ -#ifdef ORT_ROCM_BUILD - // Create ROCm provider options - cudaGetDevice(deviceId); +#elif defined(ORT_ROCM_BUILD) // const auto& api = Ort::GetApi(); // api.GetCurrentGpuDeviceId(deviceId); OrtROCMProviderOptions rocm_options; @@ -676,4 +650,25 @@ void GPUReconstructionHIP::SetONNXGPUStream(Ort::SessionOptions& session_options session_options.AppendExecutionProvider_ROCM(rocm_options); #endif // ORT_ROCM_BUILD } + +#ifndef __HIPCC__ // CUDA + +void GPUReconstructionCUDA::startGPUProfiling() +{ + GPUChkErr(cudaProfilerStart()); +} + +void GPUReconstructionCUDA::endGPUProfiling() +{ + GPUChkErr(cudaProfilerStop()); +} + +#else // HIP +void* GPUReconstructionHIP::getGPUPointer(void* ptr) +{ + void* retVal = nullptr; + GPUChkErr(hipHostGetDevicePointer(&retVal, ptr, 0)); + return retVal; +} + #endif // __HIPCC__