annotate src/gpu/hsail/vm/hsailKernelArguments.hpp @ 14768:3e9a960f0da1

HSAIL: preliminary deopt support Contributed-by: Tom Deneau <tom.deneau@amd.com>
author Doug Simon <doug.simon@oracle.com>
date Wed, 26 Mar 2014 17:33:54 +0100
parents 3e7fa4fd9199
children a6c144380ce7
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
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 #ifndef KERNEL_ARGUMENTS_HSAIL_HPP
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 #define KERNEL_ARGUMENTS_HSAIL_HPP
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;
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
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 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
48 virtual char *argsBuilderName() {return (char *)"HSAILKernelArguments";}
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
49 virtual void pushObject(void *obj) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
50 bool pushed = Hsail::_okra_push_object(_kernel, obj);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
51 assert(pushed == true, "arg push failed");
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) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
54 bool pushed = Hsail::_okra_push_boolean(_kernel, z);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
55 assert(pushed == true, "arg push failed");
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) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
58 bool pushed = Hsail::_okra_push_byte(_kernel, b);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
59 assert(pushed == true, "arg push failed");
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) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
63 bool pushed = Hsail::_okra_push_double(_kernel, d);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
64 assert(pushed == true, "arg push failed");
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) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
68 bool pushed = Hsail::_okra_push_float(_kernel, f);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
69 assert(pushed == true, "arg push failed");
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) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
73 bool pushed = Hsail::_okra_push_int(_kernel, i);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
74 assert(pushed == true, "arg push failed");
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) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
78 bool pushed = Hsail::_okra_push_long(_kernel, j);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
79 assert(pushed == true, "arg push failed");
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() {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
82 // Last argument is the exception info block
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
83 if (TraceGPUInteraction) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
84 tty->print_cr("[HSAIL] exception block=" PTR_FORMAT, _exceptionHolder);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
85 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
86 pushObject(_exceptionHolder);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
87 }
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 // 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
90 // 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
91 virtual void handleFinalIntParameter() {
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
92 if (TraceGPUInteraction) {
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
93 tty->print_cr("[HSAIL] HSAILKernelArguments, not pushing trailing int");
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
94 }
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
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
97 // for kernel arguments, final obj parameter should be an object
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
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
99 virtual void handleFinalObjParameter(void *arg) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
100 pushObject(arg);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
101 }
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
102 };
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
103
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13904
diff changeset
104 #endif // KERNEL_ARGUMENTS_HSAIL_HPP