# HG changeset patch # User Doug Simon # Date 1406821986 -7200 # Node ID f1d1ec9bcf24fa2642d19889b4df32b4f1fe4152 # Parent 1d4313c3ab38da769d11e0fe64abfe6526bcefc5 HSAIL: reset TLAB in donor thread to detect allocation in donor while kernel was active Contributed-by: Tom Deneau diff -r 1d4313c3ab38 -r f1d1ec9bcf24 src/gpu/hsail/vm/gpu_hsail_Tlab.hpp --- a/src/gpu/hsail/vm/gpu_hsail_Tlab.hpp Thu Jul 31 17:52:13 2014 +0200 +++ b/src/gpu/hsail/vm/gpu_hsail_Tlab.hpp Thu Jul 31 17:53:06 2014 +0200 @@ -138,6 +138,12 @@ 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->set_start(NULL); + tlab->set_top(NULL); + tlab->set_pf_top(NULL); + tlab->set_end(NULL); } } @@ -182,6 +188,16 @@ tlabInfo->_top = tlabInfo->last_good_top(); } + // if the donor thread allocated anything while we were running + // we will retire its tlab before overwriting 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 diff -r 1d4313c3ab38 -r f1d1ec9bcf24 src/share/vm/memory/threadLocalAllocBuffer.hpp --- a/src/share/vm/memory/threadLocalAllocBuffer.hpp Thu Jul 31 17:52:13 2014 +0200 +++ b/src/share/vm/memory/threadLocalAllocBuffer.hpp Thu Jul 31 17:53:06 2014 +0200 @@ -38,6 +38,9 @@ // used to make it available for such multiplexing. class ThreadLocalAllocBuffer: public CHeapObj { friend class VMStructs; +#ifdef GRAAL + friend class HSAILAllocationInfo; +#endif private: HeapWord* _start; // address of TLAB HeapWord* _top; // address after last allocation