Mercurial > hg > truffle
annotate src/gpu/hsail/vm/hsailKernelArguments.cpp @ 18711:88c280297bd2
put GeneratedSourcesSha1 into com.oracle.graal.hotspot.sourcegen package
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 18 Dec 2014 13:10:23 +1000 |
parents | f55f2d400797 |
children |
rev | line source |
---|---|
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 * |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 */ |
16132
7143d614bb20
Add missing include precompiled.hpp to fix windows build
Christian Wirth <christian.wirth@oracle.com>
parents:
16119
diff
changeset
|
24 #include "precompiled.hpp" |
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 #include "hsailKernelArguments.hpp" |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 void HSAILKernelArguments::collectArgs() { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 int index = 0; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 if (TraceGPUInteraction) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 tty->print_cr("[HSAIL] %s::collectArgs, args length=%d", argsBuilderName(), length()); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 // Manually iterate over the actual args array without looking at method signature |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 while (index < length()) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 oop arg = args()->obj_at(index++); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 jvalue jValue; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 if (arg == NULL) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 if (TraceGPUInteraction) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16132
diff
changeset
|
39 tty->print_cr("[HSAIL] %s::collectArgs object, _index=%d, value = " PTR_FORMAT " is a %s", argsBuilderName(), index, p2i(arg), "null"); |
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 recordNullObjectParameter(); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 pushObject(arg); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 } else { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 java_lang_boxing_object::get_value(arg, &jValue); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 BasicType basic_type = java_lang_boxing_object::basic_type(arg); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 if (basic_type == T_ILLEGAL && (!(arg->is_array()))) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 if (TraceGPUInteraction) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16132
diff
changeset
|
48 tty->print_cr("[HSAIL] %s::collectArgs object, _index=%d, value = " PTR_FORMAT " is a %s", argsBuilderName(), index, p2i(arg), arg == NULL ? "null" : arg->klass()->external_name()); |
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 pushObject(arg); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 } else if (arg->is_array()) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 if (TraceGPUInteraction) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 int array_length = ((objArrayOop) arg)->length(); |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16132
diff
changeset
|
54 tty->print_cr("[HSAIL] %s::collectArgs array, length=%d, _index=%d, value = " PTR_FORMAT, argsBuilderName(), array_length, index, p2i(arg)); |
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 pushObject(arg); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 } else { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 switch (basic_type) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 case T_INT: |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 if (TraceGPUInteraction) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 tty->print_cr("[HSAIL] %s::collectArgs, T_INT _index=%d, value = %d", argsBuilderName(), index, jValue.i); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 pushInt(jValue.i); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 break; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 case T_LONG: |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 if (TraceGPUInteraction) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16132
diff
changeset
|
67 tty->print_cr("[HSAIL] %s::collectArgs, T_LONG _index=%d, value = " JLONG_FORMAT, argsBuilderName(), index, jValue.j); |
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 pushLong(jValue.j); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 break; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 case T_FLOAT: |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 if (TraceGPUInteraction) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16132
diff
changeset
|
73 tty->print_cr("[HSAIL] %s::collectArgs, T_FLOAT _index=%d, value = %f", argsBuilderName(), index, jValue.f); |
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 pushFloat(jValue.f); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 break; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 case T_DOUBLE: |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 if (TraceGPUInteraction) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16132
diff
changeset
|
79 tty->print_cr("[HSAIL] %s::collectArgs, T_DOUBLE _index=%d, value = %lf", argsBuilderName(), index, jValue.d); |
16119
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 pushDouble(jValue.d); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 break; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 case T_BYTE: |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 if (TraceGPUInteraction) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 tty->print_cr("[HSAIL] %s::collectArgs, T_BYTE _index=%d, value = %d", argsBuilderName(), index, jValue.b); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 pushByte(jValue.b); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 break; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 case T_BOOLEAN: |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 if (TraceGPUInteraction) { |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 tty->print_cr("[HSAIL] %s::collectArgs, T_BOOLEAN _index=%d, value = %d", argsBuilderName(), index, jValue.z); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 pushBool(jValue.z); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 break; |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 pushTrailingArgs(); |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 } |
310994c667a7
HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 |