annotate src/gpu/hsail/vm/hsailKernelArguments.hpp @ 18408:2c3666f44855

Truffle: initial commit of object API implementation
author Andreas Woess <andreas.woess@jku.at>
date Tue, 18 Nov 2014 23:19:43 +0100
parents f55f2d400797
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 *
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 */
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
25 #ifndef GPU_HSAIL_VM_HSAIL_KERNEL_ARGUMENTS_HPP
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
26 #define GPU_HSAIL_VM_HSAIL_KERNEL_ARGUMENTS_HPP
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
28 #include "gpu_hsail.hpp"
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29 #include "runtime/signature.hpp"
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
30 #include "hsailArgumentsBase.hpp"
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
32 class HSAILKernelArguments : public HSAILArgumentsBase {
13888
51584f76462d pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents: 12783
diff changeset
33 friend class Hsail;
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 public:
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 private:
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 // Kernel to push into
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 address _kernel;
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
40 void* _exceptionHolder;
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 public:
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
43 HSAILKernelArguments(address kernel, Symbol* signature, objArrayOop args, bool is_static, void* exceptionHolder) : HSAILArgumentsBase(signature, args, is_static) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
44 _kernel = kernel;
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
45 _exceptionHolder = exceptionHolder;
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
46 collectArgs();
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
47 }
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
48 virtual char* argsBuilderName() {return (char*)"HSAILKernelArguments";}
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
49 virtual void pushObject(void* obj) {
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
50 jint status = Hsail::_okra_push_pointer(_kernel, obj);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
51 assert(status == 0, "arg push failed");
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
52 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
53 virtual void pushBool(jboolean z) {
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
54 jint status = Hsail::_okra_push_boolean(_kernel, z);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
55 assert(status == 0, "arg push failed");
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
56 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
57 virtual void pushByte(jbyte b) {
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
58 jint status = Hsail::_okra_push_byte(_kernel, b);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
59 assert(status == 0, "arg push failed");
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
60 }
12783
89fbf495e589 HSAIL: fix some assert logic in the argument-gathering code that shows up in non-product builds
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
61
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
62 virtual void pushDouble(jdouble d) {
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
63 jint status = Hsail::_okra_push_double(_kernel, d);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
64 assert(status == 0, "arg push failed");
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
65 }
12783
89fbf495e589 HSAIL: fix some assert logic in the argument-gathering code that shows up in non-product builds
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
66
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
67 virtual void pushFloat(jfloat f) {
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
68 jint status = Hsail::_okra_push_float(_kernel, f);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
69 assert(status == 0, "arg push failed");
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
70 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
71
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
72 virtual void pushInt(jint i) {
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
73 jint status = Hsail::_okra_push_int(_kernel, i);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
74 assert(status == 0, "arg push failed");
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
75 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
76
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
77 virtual void pushLong(jlong j) {
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
78 jint status = Hsail::_okra_push_long(_kernel, j);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16119
diff changeset
79 assert(status == 0, "arg push failed");
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
80 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
81 virtual void pushTrailingArgs() {
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
82 if (UseHSAILDeoptimization) {
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
83 // Last argument is the exception info block
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
84 if (TraceGPUInteraction) {
18043
f55f2d400797 Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16533
diff changeset
85 tty->print_cr("[HSAIL] exception block=" INTPTR_FORMAT, p2i(_exceptionHolder));
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
86 }
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
87 pushObject(_exceptionHolder);
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
88 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
89 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
90
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
91 // For kernel arguments we don't pass the final int parameter
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
92 // since we use the HSAIL workitemid instruction in place of that int value
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
93 virtual void handleFinalIntParameter() {
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 16076
diff changeset
94 ShouldNotReachHere();
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 }
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 16076
diff changeset
97 // For kernel arguments, final obj parameter should be an object
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
98 // stream source array (already checked in the base class) so here we just pass it
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
99 virtual void handleFinalObjParameter(void* arg) {
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 16076
diff changeset
100 ShouldNotReachHere();
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
101 }
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 16076
diff changeset
102
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 16076
diff changeset
103 virtual void collectArgs();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 16076
diff changeset
104
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
105 };
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
106
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
107 #endif // GPU_HSAIL_VM_HSAIL_KERNEL_ARGUMENTS_HPP