Mercurial > hg > graal-compiler
comparison src/gpu/ptx/vm/ptxKernelArguments.hpp @ 11596:91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
author | bharadwaj |
---|---|
date | Tue, 10 Sep 2013 22:39:50 -0400 |
parents | src/gpu/ptx/vm/kernelArguments.hpp@c99e65785936 |
children | d8659ad83fcc |
comparison
equal
deleted
inserted
replaced
11595:003be97acdda | 11596:91e5f927af63 |
---|---|
1 /* | |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 #ifndef KERNEL_ARGUMENTS_PTX_HPP | |
26 #define KERNEL_ARGUMENTS_PTX_HPP | |
27 | |
28 #include "runtime/gpu.hpp" | |
29 #include "runtime/signature.hpp" | |
30 | |
31 #define T_BYTE_SIZE 1 | |
32 #define T_INT_BYTE_SIZE 4 | |
33 #define T_LONG_BYTE_SIZE 8 | |
34 | |
35 class PTXKernelArguments : public SignatureIterator { | |
36 public: | |
37 // Buffer holding CUdeviceptr values that represent the kernel arguments | |
38 char _kernelArgBuffer[1024]; | |
39 // Current offset into _kernelArgBuffer | |
40 size_t _bufferOffset; | |
41 gpu::Ptx::CUdeviceptr _return_value_ptr; | |
42 private: | |
43 // Array of java argument oops | |
44 arrayOop _args; | |
45 // Current index into _args | |
46 int _index; | |
47 // Flag to indicate successful creation of kernel argument buffer | |
48 bool _success; | |
49 // Get next java argument | |
50 oop next_arg(BasicType expectedType); | |
51 | |
52 public: | |
53 PTXKernelArguments(Symbol* signature, arrayOop args, bool is_static) : SignatureIterator(signature) { | |
54 this->_return_type = T_ILLEGAL; | |
55 _index = 0; | |
56 _args = args; | |
57 _success = true; | |
58 _bufferOffset = 0; | |
59 _return_value_ptr = 0; | |
60 if (!is_static) { | |
61 // TODO : Create a device argument for receiver object and add it to _kernelBuffer | |
62 tty->print_cr("{CUDA] ****** TODO: Support for execution of non-static java methods not implemented yet."); | |
63 } | |
64 // Iterate over the entire signature | |
65 iterate(); | |
66 assert((_success && (_index == args->length())), "arg count mismatch with signature"); | |
67 } | |
68 | |
69 inline char* device_argument_buffer() { | |
70 return _kernelArgBuffer; | |
71 } | |
72 | |
73 inline size_t device_argument_buffer_size() { | |
74 return _bufferOffset; | |
75 } | |
76 | |
77 // Get the return oop value | |
78 oop get_return_oop(); | |
79 | |
80 // get device return value ptr | |
81 gpu::Ptx::CUdeviceptr get_return_value_ptr() { | |
82 return _return_value_ptr; | |
83 } | |
84 | |
85 | |
86 void do_byte(); | |
87 void do_int(); | |
88 void do_long(); | |
89 | |
90 inline void do_bool() { | |
91 /* TODO : To be implemented */ | |
92 guarantee(false, "NYI"); | |
93 } | |
94 inline void do_char() { | |
95 /* TODO : To be implemented */ | |
96 guarantee(false, "NYI"); | |
97 } | |
98 inline void do_short() { | |
99 /* TODO : To be implemented */ | |
100 guarantee(false, "NYI"); | |
101 } | |
102 inline void do_float() { | |
103 /* TODO : To be implemented */ | |
104 guarantee(false, "NYI"); | |
105 } | |
106 inline void do_double() { | |
107 /* TODO : To be implemented */ | |
108 guarantee(false, "NYI"); | |
109 } | |
110 | |
111 inline void do_object() { | |
112 /* TODO : To be implemented */ | |
113 guarantee(false, "NYI"); | |
114 } | |
115 inline void do_object(int begin, int end) { | |
116 /* TODO : To be implemented */ | |
117 guarantee(false, "NYI"); | |
118 } | |
119 inline void do_array(int begin, int end) { | |
120 /* TODO : To be implemented */ | |
121 guarantee(false, "NYI"); | |
122 } | |
123 inline void do_void() { | |
124 /* TODO : To be implemented */ | |
125 guarantee(false, "NYI"); | |
126 } | |
127 }; | |
128 | |
129 #endif // KERNEL_ARGUMENTS_HPP |