Mercurial > hg > truffle
annotate src/gpu/hsail/vm/gpu_hsail_Tlab.hpp @ 16369:f8ba57019a5d
LSRA spill optimization: move spill position to the dominator if at spill interval.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 11 Jun 2014 17:02:27 +0200 |
parents | 06eedda53e14 |
children | f1d1ec9bcf24 |
rev | line source |
---|---|
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 * |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 */ |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 #ifndef GPU_HSAIL_VM_GPU_HSAIL_TLAB_HPP |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 #define GPU_HSAIL_VM_GPU_HSAIL_TLAB_HPP |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 #include "graal/graalEnv.hpp" |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 #include "code/debugInfo.hpp" |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 #include "code/location.hpp" |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 #include "gpu_hsail.hpp" |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 class HSAILAllocationInfo; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 class HSAILTlabInfo VALUE_OBJ_CLASS_SPEC { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 friend class VMStructs; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 public: |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 // uses only the necessary fields from a full TLAB |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 HeapWord* _start; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 HeapWord* _top; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 HeapWord* _end; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 HeapWord* _last_good_top; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 HeapWord* _original_top; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 JavaThread* _donor_thread; // donor thread associated with this tlabInfo |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 HSAILAllocationInfo* _alloc_info; // same as what is in HSAILDeoptimizationInfo |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 // Accessors |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 HeapWord* start() { return _start; } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 HeapWord* top() { return _top; } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 HeapWord* end() { return _end; } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 HeapWord* last_good_top() { return _last_good_top; } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 HeapWord* original_top() { return _original_top; } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 void initialize(HeapWord* start, HeapWord* top, HeapWord* end, JavaThread* donorThread, HSAILAllocationInfo* allocInfo) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 _start = start; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 _top = _original_top = top; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 _end = end; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 _donor_thread = donorThread; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 _alloc_info = allocInfo; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 }; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 class HSAILAllocationInfo : public CHeapObj<mtInternal> { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 friend class VMStructs; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 private: |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 JavaThread** donorThreads; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 jint _num_donor_threads; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 size_t _tlab_align_reserve_bytes; // filled in from ThreadLocalAllocBuffer::alignment_reserve_in_bytes() |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 HSAILTlabInfo** _cur_tlab_infos; // array of current tlab info pointers, one per donor_thread |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 HSAILTlabInfo* _tlab_infos_pool_start; // pool for new tlab_infos |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 HSAILTlabInfo* _tlab_infos_pool_next; // where next will be allocated from |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 HSAILTlabInfo* _tlab_infos_pool_end; // where next will be allocated from |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 public: |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 HSAILAllocationInfo(jobject donor_threads_jobj, int dimX, int allocBytesPerWorkitem) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 // fill in the donorThreads array |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 objArrayOop donorThreadObjects = (objArrayOop) JNIHandles::resolve(donor_threads_jobj); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 _num_donor_threads = donorThreadObjects->length(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 guarantee(_num_donor_threads > 0, "need at least one donor thread"); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 donorThreads = NEW_C_HEAP_ARRAY(JavaThread*, _num_donor_threads, mtInternal); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 for (int i = 0; i < _num_donor_threads; i++) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 donorThreads[i] = java_lang_Thread::thread(donorThreadObjects->obj_at(i)); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 // Compute max_tlab_infos based on amount of free heap space |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 size_t max_tlab_infos; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 JavaThread* donorThread = donorThreads[0]; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 ThreadLocalAllocBuffer* tlab = &donorThread->tlab(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 size_t new_tlab_size = tlab->compute_size(0); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 size_t heap_bytes_free = Universe::heap()->unsafe_max_tlab_alloc(donorThread); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 if (new_tlab_size != 0) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 max_tlab_infos = MIN2(heap_bytes_free / new_tlab_size, (size_t)(64 * _num_donor_threads)); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 } else { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 max_tlab_infos = 8 * _num_donor_threads; // an arbitrary multiple |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 tty->print_cr("heapFree = %ld, newTlabSize=%ld, tlabInfos allocated = %ld", heap_bytes_free, new_tlab_size, max_tlab_infos); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 _cur_tlab_infos = NEW_C_HEAP_ARRAY(HSAILTlabInfo*, _num_donor_threads, mtInternal); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
103 _tlab_infos_pool_start = NEW_C_HEAP_ARRAY(HSAILTlabInfo, max_tlab_infos, mtInternal); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 _tlab_infos_pool_next = &_tlab_infos_pool_start[_num_donor_threads]; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 _tlab_infos_pool_end = &_tlab_infos_pool_start[max_tlab_infos]; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 _tlab_align_reserve_bytes = ThreadLocalAllocBuffer::alignment_reserve_in_bytes(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 // we will fill the first N tlabInfos from the donor threads |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 for (int i = 0; i < _num_donor_threads; i++) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 JavaThread* donorThread = donorThreads[i]; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 ThreadLocalAllocBuffer* tlab = &donorThread->tlab(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
113 tty->print("donorThread %d, is %p, tlab at %p -> ", i, donorThread, tlab); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 printTlabInfoFromThread(tlab); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 // Here we try to get a new tlab if current one is null. Note: |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 // eventually we may want to test if the size is too small based |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 // on some heuristic where we see how much this kernel tends to |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 // allocate, but for now we can just let it overflow and let the |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 // GPU allocate new tlabs. Actually, if we can't prime a tlab |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 // here, it might make sense to do a gc now rather than to start |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 // the kernel and have it deoptimize. How to do that? |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 if (tlab->end() == NULL) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 bool success = getNewTlabForDonorThread(tlab, i); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 if (success) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 tty->print("donorThread %d, refilled tlab, -> ", i); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 printTlabInfoFromThread(tlab); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 } else { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 tty->print("donorThread %d, could not refill tlab, left as ", i); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 printTlabInfoFromThread(tlab); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 // extract the necessary tlab fields into a TlabInfo record |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 HSAILTlabInfo* pTlabInfo = &_tlab_infos_pool_start[i]; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 _cur_tlab_infos[i] = pTlabInfo; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 pTlabInfo->initialize(tlab->start(), tlab->top(), tlab->end(), donorThread, this); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 ~HSAILAllocationInfo() { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 FREE_C_HEAP_ARRAY(HSAILTlabInfo*, _cur_tlab_infos, mtInternal); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 FREE_C_HEAP_ARRAY(HSAILTlabInfo, _tlab_infos_pool_start, mtInternal); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 FREE_C_HEAP_ARRAY(JavaThread*, donorThreads, mtInternal); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
150 void postKernelCleanup() { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 // go thru all the tlabInfos, fix up any tlab tops that overflowed |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 // complete the tlabs if they overflowed |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
153 // update the donor threads tlabs when appropriate |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 bool anyOverflows = false; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 size_t bytesAllocated = 0; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 // if there was an overflow in allocating tlabInfos, correct it here |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 if (_tlab_infos_pool_next > _tlab_infos_pool_end) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 int overflowAmount = _tlab_infos_pool_next - _tlab_infos_pool_end; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 tty->print_cr("tlabInfo allocation overflowed by %d units", overflowAmount); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 _tlab_infos_pool_next = _tlab_infos_pool_end; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
163 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 for (HSAILTlabInfo* tlabInfo = _tlab_infos_pool_start; tlabInfo < _tlab_infos_pool_next; tlabInfo++) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 tty->print_cr("postprocess tlabInfo %p, start=%p, top=%p, end=%p, last_good_top=%p", tlabInfo, |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
167 tlabInfo->start(), tlabInfo->top(), tlabInfo->end(), tlabInfo->last_good_top()); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
169 JavaThread* donorThread = tlabInfo->_donor_thread; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 ThreadLocalAllocBuffer* tlab = &donorThread->tlab(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 bool overflowed = false; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 // if a tlabInfo has NULL fields, i.e. we could not prime it on entry, |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 // or we could not get a tlab from the gpu, so ignore tlabInfo here |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 if (tlabInfo->start() != NULL) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 if (tlabInfo->top() > tlabInfo->end()) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 anyOverflows = true; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 overflowed = true; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 long overflowAmount = (long) tlabInfo->top() - (long) tlabInfo->last_good_top(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
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()); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
181 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
182 tlabInfo->_top = tlabInfo->last_good_top(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
183 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
184 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 // fill the donor thread tlab with the tlabInfo information |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 // we do this even if it will get overwritten by a later tlabinfo |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
187 // because it helps with tlab statistics for that donor thread |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
188 tlab->fill(tlabInfo->start(), tlabInfo->top(), (tlabInfo->end() - tlabInfo->start()) + tlab->alignment_reserve()); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 // if there was an overflow, make it parsable with retire = true |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 if (overflowed) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 tlab->make_parsable(true); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
193 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
194 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
195 size_t delta = (long)(tlabInfo->top()) - (long)(tlabInfo->original_top()); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
196 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
197 tty->print_cr("%ld bytes were allocated by tlabInfo %p (start %p, top %p, end %p", delta, tlabInfo, |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
198 tlabInfo->start(), tlabInfo->top(), tlabInfo->end()); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
199 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
200 bytesAllocated += delta; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
201 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
202 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
203 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
204 tty->print_cr("%ld total bytes were allocated in this kernel", bytesAllocated); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
206 if (anyOverflows) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 // Hsail::kernelStats.incOverflows(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 HSAILTlabInfo** getCurTlabInfos() { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 return _cur_tlab_infos; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
215 private: |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 // fill and retire old tlab and get a new one |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
217 // if we can't get one, no problem someone will eventually do a gc |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 bool getNewTlabForDonorThread(ThreadLocalAllocBuffer* tlab, int idx) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
219 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
220 tlab->clear_before_allocation(); // fill and retire old tlab (will also check for null) |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
221 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
222 // get a size for a new tlab that is based on the desired_size |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
223 size_t new_tlab_size = tlab->compute_size(0); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
224 if (new_tlab_size == 0) return false; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 HeapWord* tlab_start = Universe::heap()->allocate_new_tlab(new_tlab_size); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 if (tlab_start == NULL) return false; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 // ..and clear it if required |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 if (ZeroTLAB) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 Copy::zero_to_words(tlab_start, new_tlab_size); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
233 // and init the tlab pointers |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 tlab->fill(tlab_start, tlab_start, new_tlab_size); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 return true; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
237 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
238 void printTlabInfoFromThread (ThreadLocalAllocBuffer* tlab) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
239 HeapWord* start = tlab->start(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
240 HeapWord* top = tlab->top(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
241 HeapWord* end = tlab->end(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
242 // sizes are in bytes |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
243 size_t tlabFree = tlab->free() * HeapWordSize; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
244 size_t tlabUsed = tlab->used() * HeapWordSize; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
245 size_t tlabSize = tlabFree + tlabUsed; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
246 double freePct = 100.0 * (double) tlabFree/(double) tlabSize; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
247 tty->print_cr("(%p, %p, %p), siz=%ld, free=%ld (%f%%)", start, top, end, tlabSize, tlabFree, freePct); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
248 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 }; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
251 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 #endif // GPU_HSAIL_VM_GPU_HSAIL_TLAB_HPP |