@@ -453,17 +453,8 @@ bool VirtualGPU::dispatchGenericAqlPacket(
453453
454454 // TODO: placeholder to setup the kernel to populate start and end timestamp.
455455 if (timestamp_ != nullptr ) {
456- if (current_signal_ >= signal_pool_.size ()) {
457- ProfilingSignal profilingSignal = {};
458- if (HSA_STATUS_SUCCESS != hsa_signal_create (0 , 0 , nullptr , &profilingSignal.signal_ )) {
459- LogPrintfError (" Failed signal allocation id = %d" , current_signal_);
460- return false ;
461- }
462- signal_pool_.push_back (profilingSignal);
463- assert (current_signal_ < signal_pool_.size () && " Not enough signals" );
464- }
465456 // Find signal slot
466- ProfilingSignal* profilingSignal = &signal_pool_[current_signal_++ ];
457+ ProfilingSignal* profilingSignal = &signal_pool_[index & queueMask ];
467458 // Make sure we save the old results in the TS structure
468459 if (profilingSignal->ts_ != nullptr ) {
469460 profilingSignal->ts_ ->checkGpuTime ();
@@ -535,8 +526,6 @@ bool VirtualGPU::dispatchGenericAqlPacket(
535526 LogPrintfError (" Failed signal [0x%lx] wait" , signal.handle );
536527 return false ;
537528 }
538- // Reset the pool of signals
539- current_signal_ = 0 ;
540529 }
541530
542531 return true ;
@@ -645,9 +634,6 @@ bool VirtualGPU::releaseGpuMemoryFence() {
645634 // Release the pool, since runtime just completed a barrier
646635 resetKernArgPool ();
647636
648- // Reset the pool of signals
649- current_signal_ = 0 ;
650-
651637 return true ;
652638}
653639
@@ -771,9 +757,8 @@ bool VirtualGPU::create() {
771757 gpu_queue_ = roc_device_.acquireQueue (queue_size, cooperative_, cuMask_, priority_);
772758 if (!gpu_queue_) return false ;
773759
774- constexpr uint32_t kDefaultSignalPoolSize = 32 ;
775760 if (!initPool (dev ().settings ().kernargPoolSize_ ,
776- (profiling_ || (amd::IS_HIP)) ? kDefaultSignalPoolSize : 0 )) {
761+ (profiling_ || (amd::IS_HIP)) ? queue_size : 0 )) {
777762 LogError (" Couldn't allocate arguments/signals for the queue" );
778763 return false ;
779764 }
@@ -876,9 +861,6 @@ void* VirtualGPU::allocKernArg(size_t size, size_t alignment) {
876861 }
877862
878863 resetKernArgPool ();
879-
880- // Reset the pool of signals
881- current_signal_ = 0 ;
882864 }
883865 } while (true );
884866
0 commit comments