Mercurial > hg > truffle
annotate src/gpu/hsail/vm/gpu_hsail_Tlab.hpp @ 18452:94b184d89f11
FrameMappingToolImpl: inline TrackedVirtualStackSlot.transform().
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 17 Nov 2014 19:32:05 +0100 |
parents | a29e6e7b7a86 |
children | 82e5b5ccdb0c |
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; |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
44 ThreadLocalAllocBuffer* _tlab; // tlab associated with this tlabInfo |
16076
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; } |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
53 ThreadLocalAllocBuffer* tlab() { return _tlab; } |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
54 void initialize(HeapWord* start, HeapWord* top, HeapWord* end, ThreadLocalAllocBuffer* tlab, HSAILAllocationInfo* allocInfo) { |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 _start = start; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 _top = _original_top = top; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 _end = end; |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
58 _tlab = tlab; |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 _alloc_info = allocInfo; |
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 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 class HSAILAllocationInfo : public CHeapObj<mtInternal> { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 friend class VMStructs; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 private: |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
67 jint _num_tlabs; |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
68 size_t _tlab_align_reserve_bytes; // filled in from ThreadLocalAllocBuffer::alignment_reserve_in_bytes() |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
69 HSAILTlabInfo** _cur_tlab_infos; // array of current tlab info pointers, one per num_tlabs |
16076
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: |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
75 HSAILAllocationInfo(jint num_tlabs, int dimX, int allocBytesPerWorkitem) { |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
76 _num_tlabs = num_tlabs; |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
77 // if this thread doesn't have gpu_hsail_tlabs allocated yet, do so now |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
78 JavaThread* thread = JavaThread::current(); |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
79 if (thread->get_gpu_hsail_tlabs_count() == 0) { |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
80 thread->initialize_gpu_hsail_tlabs(num_tlabs); |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
81 if (TraceGPUInteraction) { |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
82 for (int i = 0; i < num_tlabs; i++) { |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
83 ThreadLocalAllocBuffer* tlab = thread->get_gpu_hsail_tlab_at(i); |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
84 tty->print("initialized gpu_hsail_tlab %d at %p -> ", i, tlab); |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
85 printTlabInfoFromThread(tlab); |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
86 } |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
87 } |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 } |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
89 |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 // 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
|
91 size_t max_tlab_infos; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 { |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
93 ThreadLocalAllocBuffer* tlab = &thread->tlab(); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 size_t new_tlab_size = tlab->compute_size(0); |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
95 size_t heap_bytes_free = Universe::heap()->unsafe_max_tlab_alloc(thread); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 if (new_tlab_size != 0) { |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
97 max_tlab_infos = MIN2(heap_bytes_free / new_tlab_size, (size_t)(64 * _num_tlabs)); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 } else { |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
99 max_tlab_infos = 8 * _num_tlabs; // an arbitrary multiple |
16076
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 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 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
|
103 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
106 _cur_tlab_infos = NEW_C_HEAP_ARRAY(HSAILTlabInfo*, _num_tlabs, mtInternal); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 _tlab_infos_pool_start = NEW_C_HEAP_ARRAY(HSAILTlabInfo, max_tlab_infos, mtInternal); |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
108 _tlab_infos_pool_next = &_tlab_infos_pool_start[_num_tlabs]; |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 _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
|
110 _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
|
111 |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
112 // we will fill the first N tlabInfos from the gpu_hsail_tlabs |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
113 for (int i = 0; i < _num_tlabs; i++) { |
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
114 ThreadLocalAllocBuffer* tlab = thread->get_gpu_hsail_tlab_at(i); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 if (TraceGPUInteraction) { |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
116 tty->print("gpu_hsail_tlab %d at %p -> ", i, tlab); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 printTlabInfoFromThread(tlab); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 // 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
|
121 // 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
|
122 // 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
|
123 // 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
|
124 // 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
|
125 // 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
|
126 // 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
|
127 if (tlab->end() == NULL) { |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
128 bool success = getNewGpuHsailTlab(tlab); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 if (success) { |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
131 tty->print("gpu_hsail_tlab %d, refilled tlab, -> ", i); |
16076
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 } else { |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
134 tty->print("gpu_hsail_tlab %d, could not refill tlab, left as ", i); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 printTlabInfoFromThread(tlab); |
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 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 // 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
|
141 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
|
142 _cur_tlab_infos[i] = pTlabInfo; |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
143 pTlabInfo->initialize(tlab->start(), tlab->top(), tlab->end(), tlab, this); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 ~HSAILAllocationInfo() { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 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
|
149 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
|
150 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 void postKernelCleanup() { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
153 // 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
|
154 // complete the tlabs if they overflowed |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
155 // update the gpu_hsail_tlabs when appropriate |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 bool anyOverflows = false; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 size_t bytesAllocated = 0; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 // 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
|
159 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
|
160 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 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
|
162 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
|
163 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 _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
|
165 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 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
|
167 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 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
|
169 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
|
170 } |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
171 ThreadLocalAllocBuffer* tlab = tlabInfo->tlab(); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 bool overflowed = false; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 // 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
|
174 // 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
|
175 if (tlabInfo->start() != NULL) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 if (tlabInfo->top() > tlabInfo->end()) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 anyOverflows = true; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 overflowed = true; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 long overflowAmount = (long) tlabInfo->top() - (long) tlabInfo->last_good_top(); |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
181 tty->print_cr("tlabInfo %p (tlab = %p) overflowed by %ld bytes, setting last good top to %p", tlabInfo, tlab, overflowAmount, tlabInfo->last_good_top()); |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
182 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
183 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
|
184 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
186 // fill the gpu_hsail_tlab with the tlabInfo information |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
187 // we do this even if it will get overwritten by a later tlabinfo |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
188 // because it helps with tlab statistics for that tlab |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 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
|
190 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 // 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
|
192 if (overflowed) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
193 tlab->make_parsable(true); |
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 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
196 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
|
197 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
198 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
|
199 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
|
200 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
201 bytesAllocated += delta; |
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 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
204 if (TraceGPUInteraction) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 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
|
206 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 if (anyOverflows) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 // Hsail::kernelStats.incOverflows(); |
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 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 HSAILTlabInfo** getCurTlabInfos() { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 return _cur_tlab_infos; |
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 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 private: |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
217 // 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
|
218 // if we can't get one, no problem someone will eventually do a gc |
16795
a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16668
diff
changeset
|
219 bool getNewGpuHsailTlab(ThreadLocalAllocBuffer* tlab) { |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
220 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
221 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
|
222 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
223 // 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
|
224 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
|
225 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
|
226 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 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
|
228 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
|
229 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 // ..and clear it if required |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 if (ZeroTLAB) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 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
|
233 } |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 // and init the tlab pointers |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 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
|
236 return true; |
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 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
239 void printTlabInfoFromThread (ThreadLocalAllocBuffer* tlab) { |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
240 HeapWord* start = tlab->start(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
241 HeapWord* top = tlab->top(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
242 HeapWord* end = tlab->end(); |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
243 // sizes are in bytes |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
244 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
|
245 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
|
246 size_t tlabSize = tlabFree + tlabUsed; |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
247 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
|
248 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
|
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 |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
253 #endif // GPU_HSAIL_VM_GPU_HSAIL_TLAB_HPP |