src/gpu/hsail/vm/gpu_hsail_Tlab.hpp

Print this page

        

@@ -136,10 +136,13 @@
 
       // extract the necessary tlab fields into a TlabInfo record
       HSAILTlabInfo* pTlabInfo = &_tlab_infos_pool_start[i];
       _cur_tlab_infos[i] = pTlabInfo;
       pTlabInfo->initialize(tlab->start(), tlab->top(), tlab->end(), donorThread, this);
+
+      // reset the real tlab fields to zero so we are sure the thread doesn't use it
+      tlab->reset_to_null();
     }
   }
 
   ~HSAILAllocationInfo() {
     FREE_C_HEAP_ARRAY(HSAILTlabInfo*, _cur_tlab_infos, mtInternal);

@@ -180,10 +183,20 @@
             tty->print_cr("tlabInfo %p (donorThread = %p) overflowed by %ld bytes, setting last good top to %p", tlabInfo, donorThread, overflowAmount, tlabInfo->last_good_top());
           }
           tlabInfo->_top = tlabInfo->last_good_top();
         }
 
+        // see if the donor thread actually tried to allocate anything while we were running
+        // if so we will retire that one as we overwrite with our new one
+        if (tlab->top() != NULL) {
+          if (TraceGPUInteraction) {
+            tty->print("Donor Thread allocated new tlab");
+            printTlabInfoFromThread(tlab);
+          }
+          tlab->make_parsable(true);
+        }
+
         // fill the donor thread tlab with the tlabInfo information
         // we do this even if it will get overwritten by a later tlabinfo
         // because it helps with tlab statistics for that donor thread
         tlab->fill(tlabInfo->start(), tlabInfo->top(), (tlabInfo->end() - tlabInfo->start()) + tlab->alignment_reserve());