Mercurial > hg > truffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
16667:1d4313c3ab38 | 16668:f1d1ec9bcf24 |
---|---|
136 | 136 |
137 // extract the necessary tlab fields into a TlabInfo record | 137 // extract the necessary tlab fields into a TlabInfo record |
138 HSAILTlabInfo* pTlabInfo = &_tlab_infos_pool_start[i]; | 138 HSAILTlabInfo* pTlabInfo = &_tlab_infos_pool_start[i]; |
139 _cur_tlab_infos[i] = pTlabInfo; | 139 _cur_tlab_infos[i] = pTlabInfo; |
140 pTlabInfo->initialize(tlab->start(), tlab->top(), tlab->end(), donorThread, this); | 140 pTlabInfo->initialize(tlab->start(), tlab->top(), tlab->end(), donorThread, this); |
141 | |
142 // reset the real tlab fields to zero so we are sure the thread doesn't use it | |
143 tlab->set_start(NULL); | |
144 tlab->set_top(NULL); | |
145 tlab->set_pf_top(NULL); | |
146 tlab->set_end(NULL); | |
141 } | 147 } |
142 } | 148 } |
143 | 149 |
144 ~HSAILAllocationInfo() { | 150 ~HSAILAllocationInfo() { |
145 FREE_C_HEAP_ARRAY(HSAILTlabInfo*, _cur_tlab_infos, mtInternal); | 151 FREE_C_HEAP_ARRAY(HSAILTlabInfo*, _cur_tlab_infos, mtInternal); |
180 tty->print_cr("tlabInfo %p (donorThread = %p) overflowed by %ld bytes, setting last good top to %p", tlabInfo, donorThread, overflowAmount, tlabInfo->last_good_top()); | 186 tty->print_cr("tlabInfo %p (donorThread = %p) overflowed by %ld bytes, setting last good top to %p", tlabInfo, donorThread, overflowAmount, tlabInfo->last_good_top()); |
181 } | 187 } |
182 tlabInfo->_top = tlabInfo->last_good_top(); | 188 tlabInfo->_top = tlabInfo->last_good_top(); |
183 } | 189 } |
184 | 190 |
191 // if the donor thread allocated anything while we were running | |
192 // we will retire its tlab before overwriting with our new one | |
193 if (tlab->top() != NULL) { | |
194 if (TraceGPUInteraction) { | |
195 tty->print("Donor Thread allocated new tlab"); | |
196 printTlabInfoFromThread(tlab); | |
197 } | |
198 tlab->make_parsable(true); | |
199 } | |
200 | |
185 // fill the donor thread tlab with the tlabInfo information | 201 // fill the donor thread tlab with the tlabInfo information |
186 // we do this even if it will get overwritten by a later tlabinfo | 202 // we do this even if it will get overwritten by a later tlabinfo |
187 // because it helps with tlab statistics for that donor thread | 203 // because it helps with tlab statistics for that donor thread |
188 tlab->fill(tlabInfo->start(), tlabInfo->top(), (tlabInfo->end() - tlabInfo->start()) + tlab->alignment_reserve()); | 204 tlab->fill(tlabInfo->start(), tlabInfo->top(), (tlabInfo->end() - tlabInfo->start()) + tlab->alignment_reserve()); |
189 | 205 |