Signal Fix: The signals in a stream are re-used
1. Before, the signal pool is increased depending on the usage
2. After, a static number of signals are allocated to the pool
Only these are used by hip in a stream
3. If the signals required are more than the pool size, the
stream has to wait to make sure all the signals are available
4. Once they are available, the stream can use them
5. Removed HIP_NUM_SIGNALS_PER_STREAM because of redundancy with HIP_STREAM_SIGNALS
6. Increased signal count from 2 to 32.
Future Work: Dynamically increase the pool size depending on the number of
streams allocated by the application. And, null stream should have more signals
Change-Id: I6be36e084f26bb04766fabf776c7210aee0f9e91
[ROCm/hip commit: 9062ebcf3a]
This commit is contained in:
@@ -67,7 +67,7 @@ int HIP_OPTIMAL_MEM_TRANSFER = 0; //ENV Variable to test different memory transf
|
||||
int HIP_H2D_MEM_TRANSFER_THRESHOLD_DIRECT_OR_STAGING = 0;
|
||||
int HIP_H2D_MEM_TRANSFER_THRESHOLD_STAGING_OR_PININPLACE = 0;
|
||||
int HIP_D2H_MEM_TRANSFER_THRESHOLD = 0;
|
||||
int HIP_STREAM_SIGNALS = 2; /* number of signals to allocate at stream creation */
|
||||
int HIP_STREAM_SIGNALS = 32; /* number of signals to allocate at stream creation */
|
||||
int HIP_VISIBLE_DEVICES = 0; /* Contains a comma-separated sequence of GPU identifiers */
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ void ihipStream_t::wait(LockedAccessor_StreamCrit_t &crit, bool assertQueueEmpty
|
||||
// Reset the stream to "empty" - next command will not set up an inpute dependency on any older signal.
|
||||
crit->_last_command_type = ihipCommandCopyH2D;
|
||||
crit->_last_copy_signal = NULL;
|
||||
crit->_signalCnt = 0;
|
||||
// crit->_signalCnt = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -309,12 +309,14 @@ ihipDevice_t * ihipStream_t::getDevice() const
|
||||
ihipSignal_t *ihipStream_t::allocSignal(LockedAccessor_StreamCrit_t &crit)
|
||||
{
|
||||
int numToScan = crit->_signalPool.size();
|
||||
|
||||
crit->_signalCnt++;
|
||||
if(crit->_signalCnt == HIP_NUM_SIGNALS_PER_STREAM){
|
||||
if(crit->_signalCnt == HIP_STREAM_SIGNALS){
|
||||
this->wait(crit);
|
||||
crit->_signalCnt = 0;
|
||||
}
|
||||
|
||||
return &crit->_signalPool[crit->_signalCnt];
|
||||
|
||||
do {
|
||||
auto thisCursor = crit->_signalCursor;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user