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].
 
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].
 
hipError_t hipStreamWriteValue32 (hipStream_t stream, void *ptr, uint32_t value, unsigned int flags)
 Enqueues a write command to the stream.[BETA].
 
hipError_t hipStreamWriteValue64 (hipStream_t stream, void *ptr, uint64_t value, unsigned int flags)
 Enqueues a write command to the stream.[BETA].
 
hipError_t hipStreamBatchMemOp (hipStream_t stream, unsigned int count, hipStreamBatchMemOpParams *paramArray, unsigned int flags)
 Enqueues an array of stream memory operations in the stream.[BETA].
 
hipError_t hipGraphAddBatchMemOpNode (hipGraphNode_t *phGraphNode, hipGraph_t hGraph, const hipGraphNode_t *dependencies, size_t numDependencies, const hipBatchMemOpNodeParams *nodeParams)
 Creates a batch memory operation node and adds it to a graph.[BETA].
 
hipError_t hipGraphBatchMemOpNodeGetParams (hipGraphNode_t hNode, hipBatchMemOpNodeParams *nodeParams_out)
 Returns a batch mem op node's parameters.[BETA].
 
hipError_t hipGraphBatchMemOpNodeSetParams (hipGraphNode_t hNode, hipBatchMemOpNodeParams *nodeParams)
 Sets the batch mem op node's parameters.[BETA].
 
hipError_t hipGraphExecBatchMemOpNodeSetParams (hipGraphExec_t hGraphExec, hipGraphNode_t hNode, const hipBatchMemOpNodeParams *nodeParams)
 Sets the parameters for a batch mem op node in the given graphExec.[BETA].
 

Detailed Description



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

Function Documentation

◆ hipGraphAddBatchMemOpNode()

hipError_t hipGraphAddBatchMemOpNode ( hipGraphNode_t phGraphNode,
hipGraph_t  hGraph,
const hipGraphNode_t dependencies,
size_t  numDependencies,
const hipBatchMemOpNodeParams nodeParams 
)

Creates a batch memory operation node and adds it to a graph.[BETA].

Parameters
[in]phGraphNode- Returns the newly created node
[in]hGraph- Graph to which to add the node
[in]dependencies- Dependencies of the node
[in]numDependencies- Number of dependencies
[in]nodeParams- Parameters for the node
Returns
hipSuccess, hipErrorInvalidValue
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
hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64. hipStreamWriteValue64, hipStreamBatchMemOp

◆ hipGraphBatchMemOpNodeGetParams()

hipError_t hipGraphBatchMemOpNodeGetParams ( hipGraphNode_t  hNode,
hipBatchMemOpNodeParams nodeParams_out 
)

Returns a batch mem op node's parameters.[BETA].

Parameters
[in]hNode- Node to get the parameters for
[in]nodeParams_out- Pointer to return the parameters
Returns
hipSuccess, hipErrorInvalidValue

Returns the parameters of batch mem op node hNode in nodeParams_out. The paramArray returned in nodeParams_out is owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should not be modified directly.

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
hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64. hipStreamWriteValue64. hipGraphBatchMemOpNodeSetParams

◆ hipGraphBatchMemOpNodeSetParams()

hipError_t hipGraphBatchMemOpNodeSetParams ( hipGraphNode_t  hNode,
hipBatchMemOpNodeParams nodeParams 
)

Sets the batch mem op node's parameters.[BETA].

Parameters
[in]hNode- Node to set the parameters for
[in]nodeParams- Parameters to copy
Returns
hipSuccess, hipErrorInvalidValue

Sets the parameters of batch mem op node hNode to nodeParams.

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
hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64. hipStreamWriteValue64, hipGraphBatchMemOpNodeGetParams

◆ hipGraphExecBatchMemOpNodeSetParams()

hipError_t hipGraphExecBatchMemOpNodeSetParams ( hipGraphExec_t  hGraphExec,
hipGraphNode_t  hNode,
const hipBatchMemOpNodeParams nodeParams 
)

Sets the parameters for a batch mem op node in the given graphExec.[BETA].

Parameters
[in]hGraphExec- The executable graph in which to set the specified node
[in]hNode- Batch mem op node from the graph from which graphExec was instantiated
[in]nodeParams- Updated Parameters to set
Returns
hipSuccess, hipErrorInvalidValue

Sets the parameters of a batch mem op node in an executable graph hGraphExec. The node is identified by the corresponding node hNode in the non-executable graph, from which the executable graph was instantiated.

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
hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64. hipStreamWriteValue64, hipStreamBatchMemOp

◆ hipStreamBatchMemOp()

hipError_t hipStreamBatchMemOp ( hipStream_t  stream,
unsigned int  count,
hipStreamBatchMemOpParams paramArray,
unsigned int  flags 
)

Enqueues an array of stream memory operations in the stream.[BETA].

Parameters
[in]stream- Stream identifier
[in]count- The number of operations in the array. Must be less than 256
[in]paramArray- The types and parameters of the individual operations.
[in]flags- Reserved for future expansion; must be 0.
Returns
hipSuccess, hipErrorInvalidValue

Batch operations to synchronize the stream via memory operations.

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
hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64. hipStreamWriteValue64

◆ 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. While this feature is complete, it can change and might 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. While this feature is complete, it can change and might 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. While this feature is complete, it can change and might 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. While this feature is complete, it can change and might have outstanding issues.
See also
hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32, hipStreamWaitValue64