Implementation for stream priority
- Requires ROCm 1.9.x or higher - Requires HCC with PR#886 merged Change-Id: Id7c95ea091ee610e80c9ad815f1cb989cba570ca
This commit is contained in:
@@ -590,8 +590,6 @@ const char* hipGetErrorString(hipError_t hipError);
|
||||
*
|
||||
* The following Stream APIs are not (yet) supported in HIP:
|
||||
* - cudaStreamAttachMemAsync
|
||||
* - cudaStreamCreateWithPriority
|
||||
* - cudaStreamGetPriority
|
||||
*/
|
||||
|
||||
|
||||
@@ -609,7 +607,7 @@ const char* hipGetErrorString(hipError_t hipError);
|
||||
*
|
||||
* @return #hipSuccess, #hipErrorInvalidValue
|
||||
*
|
||||
* @see hipStreamCreateWithFlags, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy
|
||||
* @see hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy
|
||||
*/
|
||||
hipError_t hipStreamCreate(hipStream_t* stream);
|
||||
|
||||
@@ -628,12 +626,50 @@ hipError_t hipStreamCreate(hipStream_t* stream);
|
||||
* stream. See #hipStreamDefault, #hipStreamNonBlocking.
|
||||
*
|
||||
*
|
||||
* @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy
|
||||
* @see hipStreamCreate, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy
|
||||
*/
|
||||
|
||||
hipError_t hipStreamCreateWithFlags(hipStream_t* stream, unsigned int flags);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Create an asynchronous stream with the specified priority.
|
||||
*
|
||||
* @param[in, out] stream Pointer to new stream
|
||||
* @param[in ] flags to control stream creation.
|
||||
* @param[in ] priority of the stream. Lower numbers represent higher priorities.
|
||||
* @return #hipSuccess, #hipErrorInvalidValue
|
||||
*
|
||||
* Create a new asynchronous stream with the specified priority. @p stream returns an opaque handle
|
||||
* that can be used to reference the newly created stream in subsequent hipStream* commands. The
|
||||
* stream is allocated on the heap and will remain allocated even if the handle goes out-of-scope.
|
||||
* To release the memory used by the stream, applicaiton must call hipStreamDestroy. Flags controls
|
||||
* behavior of the stream. See #hipStreamDefault, #hipStreamNonBlocking.
|
||||
*
|
||||
*
|
||||
* @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy
|
||||
*/
|
||||
|
||||
hipError_t hipStreamCreateWithPriority(hipStream_t* stream, unsigned int flags, int priority);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns numerical values that correspond to the least and greatest stream priority.
|
||||
*
|
||||
* @param[in, out] leastPriority pointer in which value corresponding to least priority is returned.
|
||||
* @param[in, out] greatestPriority pointer in which value corresponding to greatest priority is returned.
|
||||
*
|
||||
* Returns in *leastPriority and *greatestPriority the numerical values that correspond to the least
|
||||
* and greatest stream priority respectively. Stream priorities follow a convention where lower numbers
|
||||
* imply greater priorities. The range of meaningful stream priorities is given by
|
||||
* [*greatestPriority, *leastPriority]. If the user attempts to create a stream with a priority value
|
||||
* that is outside the the meaningful range as specified by this API, the priority is automatically
|
||||
* clamped to within the valid range.
|
||||
*/
|
||||
|
||||
hipError_t hipDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Destroys the specified stream.
|
||||
*
|
||||
@@ -649,7 +685,7 @@ hipError_t hipStreamCreateWithFlags(hipStream_t* stream, unsigned int flags);
|
||||
* The queue may be destroyed while some commands are still inflight, or may wait for all commands
|
||||
* queued to the stream before destroying it.
|
||||
*
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamQuery, hipStreamWaitEvent,
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamQuery, hipStreamWaitEvent,
|
||||
* hipStreamSynchronize
|
||||
*/
|
||||
hipError_t hipStreamDestroy(hipStream_t stream);
|
||||
@@ -667,7 +703,7 @@ hipError_t hipStreamDestroy(hipStream_t stream);
|
||||
* host threads are sending work to the stream, the status may change immediately after the function
|
||||
* is called. It is typically used for debug.
|
||||
*
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamWaitEvent, hipStreamSynchronize,
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamWaitEvent, hipStreamSynchronize,
|
||||
* hipStreamDestroy
|
||||
*/
|
||||
hipError_t hipStreamQuery(hipStream_t stream);
|
||||
@@ -689,7 +725,7 @@ hipError_t hipStreamQuery(hipStream_t stream);
|
||||
* This command honors the hipDeviceLaunchBlocking flag, which controls whether the wait is active
|
||||
* or blocking.
|
||||
*
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamWaitEvent, hipStreamDestroy
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamWaitEvent, hipStreamDestroy
|
||||
*
|
||||
*/
|
||||
hipError_t hipStreamSynchronize(hipStream_t stream);
|
||||
@@ -712,7 +748,7 @@ hipError_t hipStreamSynchronize(hipStream_t stream);
|
||||
* does not impliciy wait for commands in the default stream to complete, even if the specified
|
||||
* stream is created with hipStreamNonBlocking = 0.
|
||||
*
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamSynchronize, hipStreamDestroy
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamDestroy
|
||||
*/
|
||||
hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags);
|
||||
|
||||
@@ -732,6 +768,23 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int
|
||||
*/
|
||||
hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int* flags);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Query the priority of a stream.
|
||||
*
|
||||
* @param[in] stream stream to be queried
|
||||
* @param[in,out] priority Pointer to an unsigned integer in which the stream's priority is returned
|
||||
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidResourceHandle
|
||||
*
|
||||
* @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidResourceHandle
|
||||
*
|
||||
* Query the priority of a stream. The priority is returned in in priority.
|
||||
*
|
||||
* @see hipStreamCreateWithFlags
|
||||
*/
|
||||
hipError_t hipStreamGetPriority(hipStream_t stream, int* priority);
|
||||
|
||||
|
||||
/**
|
||||
* Stream CallBack struct
|
||||
*/
|
||||
@@ -749,7 +802,7 @@ typedef void (*hipStreamCallback_t)(hipStream_t stream, hipError_t status, void*
|
||||
* @return #hipSuccess, #hipErrorInvalidResourceHandle, #hipErrorNotSupported
|
||||
*
|
||||
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamQuery, hipStreamSynchronize,
|
||||
* hipStreamWaitEvent, hipStreamDestroy
|
||||
* hipStreamWaitEvent, hipStreamDestroy, hipStreamCreateWithPriority
|
||||
*
|
||||
*/
|
||||
hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback, void* userData,
|
||||
|
||||
@@ -890,6 +890,13 @@ inline static hipError_t hipStreamCreateWithFlags(hipStream_t* stream, unsigned
|
||||
return hipCUDAErrorTohipError(cudaStreamCreateWithFlags(stream, flags));
|
||||
}
|
||||
|
||||
inline static hipError_t hipStreamCreateWithPriority(hipStream_t* stream, unsigned int flags, int priority) {
|
||||
return hipCUDAErrorTohipError(cudaStreamCreateWithPriority(stream, flags, priority));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) {
|
||||
return hipCUDAErrorTohipError(cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority));
|
||||
}
|
||||
|
||||
inline static hipError_t hipStreamCreate(hipStream_t* stream) {
|
||||
return hipCUDAErrorTohipError(cudaStreamCreate(stream));
|
||||
@@ -903,6 +910,13 @@ inline static hipError_t hipStreamDestroy(hipStream_t stream) {
|
||||
return hipCUDAErrorTohipError(cudaStreamDestroy(stream));
|
||||
}
|
||||
|
||||
inline static hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags) {
|
||||
return hipCUDAErrorTohipError(cudaStreamGetFlags(stream, flags));
|
||||
}
|
||||
|
||||
inline static hipError_t hipStreamGetPriority(hipStream_t stream, int *priority) {
|
||||
return hipCUDAErrorTohipError(cudaStreamGetPriority(stream, priority));
|
||||
}
|
||||
|
||||
inline static hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event,
|
||||
unsigned int flags) {
|
||||
|
||||
Reference in New Issue
Block a user