This page contains proposed changes for a future release of ROCm. Read the latest Linux release of ROCm documentation for your production environments.

Stream Memory Operations

Stream Memory Operations#

HIP Runtime API Reference: Stream Memory Operations
Stream Memory Operations
Collaboration diagram for Stream Memory Operations:

Functions

hipError_t hipStreamWaitValue32 (hipStream_t stream, void *ptr, uint32_t value, unsigned int flags, uint32_t mask)
 Enqueues a wait command to the stream.[BETA]. More...
 
hipError_t hipStreamWaitValue64 (hipStream_t stream, void *ptr, uint64_t value, unsigned int flags, uint64_t mask)
 Enqueues a wait command to the stream.[BETA]. More...
 
hipError_t hipStreamWriteValue32 (hipStream_t stream, void *ptr, uint32_t value, unsigned int flags)
 Enqueues a write command to the stream.[BETA]. More...
 
hipError_t hipStreamWriteValue64 (hipStream_t stream, void *ptr, uint64_t value, unsigned int flags)
 Enqueues a write command to the stream.[BETA]. More...
 

Detailed Description



This section describes Stream Memory Wait and Write functions of HIP runtime API.

Function Documentation

◆ hipStreamWaitValue32()

hipError_t hipStreamWaitValue32 ( hipStream_t  stream,
void *  ptr,
uint32_t  value,
unsigned int  flags,
uint32_t  mask 
)

Enqueues a wait command to the stream.[BETA].

Parameters
[in]stream- Stream identifier
[in]ptr- Pointer to memory object allocated using 'hipMallocSignalMemory' flag
[in]value- Value to be used in compare operation
[in]flags- Defines the compare operation, supported values are hipStreamWaitValueGte hipStreamWaitValueEq, hipStreamWaitValueAnd and hipStreamWaitValueNor
[in]mask- Mask to be applied on value at memory before it is compared with value, default value is set to enable every bit
Returns
hipSuccess, hipErrorInvalidValue

Enqueues a wait command to the stream, all operations enqueued on this stream after this, will not execute until the defined wait condition is true.

hipStreamWaitValueGte: waits until *ptr&mask >= value hipStreamWaitValueEq : waits until *ptr&mask == value hipStreamWaitValueAnd: waits until ((*ptr&mask) & value) != 0 hipStreamWaitValueNor: waits until ~((*ptr&mask) | (value&mask)) != 0

Note
when using 'hipStreamWaitValueNor', mask is applied on both 'value' and '*ptr'.
Support for hipStreamWaitValue32 can be queried using 'hipDeviceGetAttribute()' and 'hipDeviceAttributeCanUseStreamWaitValue' flag.
Warning
This API is marked as beta, meaning, while this is feature complete, it is still open to changes and may have outstanding issues.
See also
hipExtMallocWithFlags, hipFree, hipStreamWaitValue64, hipStreamWriteValue64, hipStreamWriteValue32, hipDeviceGetAttribute

◆ hipStreamWaitValue64()

hipError_t hipStreamWaitValue64 ( hipStream_t  stream,
void *  ptr,
uint64_t  value,
unsigned int  flags,
uint64_t  mask 
)

Enqueues a wait command to the stream.[BETA].

Parameters
[in]stream- Stream identifier
[in]ptr- Pointer to memory object allocated using 'hipMallocSignalMemory' flag
[in]value- Value to be used in compare operation
[in]flags- Defines the compare operation, supported values are hipStreamWaitValueGte hipStreamWaitValueEq, hipStreamWaitValueAnd and hipStreamWaitValueNor.
[in]mask- Mask to be applied on value at memory before it is compared with value default value is set to enable every bit
Returns
hipSuccess, hipErrorInvalidValue

Enqueues a wait command to the stream, all operations enqueued on this stream after this, will not execute until the defined wait condition is true.

hipStreamWaitValueGte: waits until *ptr&mask >= value hipStreamWaitValueEq : waits until *ptr&mask == value hipStreamWaitValueAnd: waits until ((*ptr&mask) & value) != 0 hipStreamWaitValueNor: waits until ~((*ptr&mask) | (value&mask)) != 0

Note
when using 'hipStreamWaitValueNor', mask is applied on both 'value' and '*ptr'.
Support for hipStreamWaitValue64 can be queried using 'hipDeviceGetAttribute()' and 'hipDeviceAttributeCanUseStreamWaitValue' flag.
Warning
This API is marked as beta, meaning, while this is feature complete, it is still open to changes and may have outstanding issues.
See also
hipExtMallocWithFlags, hipFree, hipStreamWaitValue32, hipStreamWriteValue64, hipStreamWriteValue32, hipDeviceGetAttribute

◆ hipStreamWriteValue32()

hipError_t hipStreamWriteValue32 ( hipStream_t  stream,
void *  ptr,
uint32_t  value,
unsigned int  flags 
)

Enqueues a write command to the stream.[BETA].

Parameters
[in]stream- Stream identifier
[in]ptr- Pointer to a GPU accessible memory object
[in]value- Value to be written
[in]flags- reserved, ignored for now, will be used in future releases
Returns
hipSuccess, hipErrorInvalidValue

Enqueues a write command to the stream, write operation is performed after all earlier commands on this stream have completed the execution.

Warning
This API is marked as beta, meaning, while this is feature complete, it is still open to changes and may have outstanding issues.
See also
hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64

◆ hipStreamWriteValue64()

hipError_t hipStreamWriteValue64 ( hipStream_t  stream,
void *  ptr,
uint64_t  value,
unsigned int  flags 
)

Enqueues a write command to the stream.[BETA].

Parameters
[in]stream- Stream identifier
[in]ptr- Pointer to a GPU accessible memory object
[in]value- Value to be written
[in]flags- reserved, ignored for now, will be used in future releases
Returns
hipSuccess, hipErrorInvalidValue

Enqueues a write command to the stream, write operation is performed after all earlier commands on this stream have completed the execution.

Warning
This API is marked as beta, meaning, while this is feature complete, it is still open to changes and may have outstanding issues.
See also
hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64