Mercurial > hg > graal-compiler
diff src/gpu/hsail/vm/gpu_hsail_Tlab.hpp @ 16668:f1d1ec9bcf24
HSAIL: reset TLAB in donor thread to detect allocation in donor while kernel was active
Contributed-by: Tom Deneau <tom.deneau@amd.com>
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 31 Jul 2014 17:53:06 +0200 |
parents | 06eedda53e14 |
children | a29e6e7b7a86 |
line wrap: on
line diff
--- 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