-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add param configs to allow hold more input and output params on GPU.
- Loading branch information
Showing
5 changed files
with
134 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
|
||
#include "type_defs.h" | ||
|
||
namespace warpctc { | ||
|
||
static gpuError_t memcpy_d2h_async(void *dst, const void *src, size_t bytes, GPUstream stream) { | ||
gpuError_t status; | ||
#ifdef __HIPCC__ | ||
status = hipMemcpyAsync(dst, src, bytes, hipMemcpyDeviceToHost, stream); | ||
#else | ||
status = cudaMemcpyAsync(dst, src, bytes, cudaMemcpyDeviceToHost, stream); | ||
#endif | ||
return status; | ||
} | ||
|
||
static gpuError_t synchronize(GPUstream stream) { | ||
gpuError_t status; | ||
#ifdef __HIPCC__ | ||
status = hipStreamSynchronize(stream); | ||
#else | ||
status = cudaStreamSynchronize(stream); | ||
#endif | ||
return status; | ||
} | ||
|
||
static gpuError_t memcpy_d2h_sync(void *dst, const void *src, size_t bytes, GPUstream stream) { | ||
gpuError_t status = memcpy_d2h_async(dst, src, bytes, stream); | ||
if (status != gpuSuccess) { | ||
return status; | ||
} | ||
return synchronize(stream); | ||
} | ||
|
||
} // namespace warpctc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters