Mercurial > hg > graal-compiler
annotate src/gpu/ptx/vm/ptxKernelArguments.cpp @ 12545:11b086b1bae4
[PTX] fix warnings in ptx code
author | S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com> |
---|---|
date | Wed, 23 Oct 2013 13:54:21 -0400 |
parents | f020e149c1b6 |
children | 1a7e7011a341 |
rev | line source |
---|---|
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
1 /* |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
4 * |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
8 * |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
13 * accompanied this code). |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
14 * |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
18 * |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
21 * questions. |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
22 * |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
23 */ |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
24 |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
11485
diff
changeset
|
26 #include "ptxKernelArguments.hpp" |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
27 #include "runtime/javaCalls.hpp" |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
28 |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
29 gpu::Ptx::cuda_cu_memalloc_func_t gpu::Ptx::_cuda_cu_memalloc; |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
30 gpu::Ptx::cuda_cu_memcpy_htod_func_t gpu::Ptx::_cuda_cu_memcpy_htod; |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
31 |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
32 // Get next java argument |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
33 oop PTXKernelArguments::next_arg(BasicType expectedType) { |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
34 assert(_index < _args->length(), "out of bounds"); |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
35 oop arg = ((objArrayOop) (_args))->obj_at(_index++); |
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
36 assert(expectedType == T_OBJECT || |
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
37 java_lang_boxing_object::is_instance(arg, expectedType), "arg type mismatch"); |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
38 return arg; |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
39 } |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
40 |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
41 void PTXKernelArguments::do_int() { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
42 // If the parameter is a return value, |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
43 if (is_return_type()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
44 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
45 // Allocate device memory for T_INT return value pointer on device. Size in bytes |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
46 int status = gpu::Ptx::_cuda_cu_memalloc(&_dev_return_value, T_INT_BYTE_SIZE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
47 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
48 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
49 _success = false; |
11894
c7abc8411011
Fixed BasicPTXTest and IntegerPTXTest
Morris Meyer <morris.meyer@oracle.com>
parents:
11821
diff
changeset
|
50 return; |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
51 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
52 // Push _dev_return_value to _kernelBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
53 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _dev_return_value; |
11894
c7abc8411011
Fixed BasicPTXTest and IntegerPTXTest
Morris Meyer <morris.meyer@oracle.com>
parents:
11821
diff
changeset
|
54 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
55 _bufferOffset += sizeof(_dev_return_value); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
56 } else { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
57 // Get the next java argument and its value which should be a T_INT |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
58 oop arg = next_arg(T_INT); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
59 // Copy the java argument value to kernelArgBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
60 jvalue intval; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
61 if (java_lang_boxing_object::get_value(arg, &intval) != T_INT) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
62 tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_INT"); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
63 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
64 return; |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
65 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
66 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
67 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = intval.i; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
68 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
69 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
70 _bufferOffset += sizeof(intval.i); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
71 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
72 return; |
11894
c7abc8411011
Fixed BasicPTXTest and IntegerPTXTest
Morris Meyer <morris.meyer@oracle.com>
parents:
11821
diff
changeset
|
73 } |
c7abc8411011
Fixed BasicPTXTest and IntegerPTXTest
Morris Meyer <morris.meyer@oracle.com>
parents:
11821
diff
changeset
|
74 |
c7abc8411011
Fixed BasicPTXTest and IntegerPTXTest
Morris Meyer <morris.meyer@oracle.com>
parents:
11821
diff
changeset
|
75 void PTXKernelArguments::do_float() { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
76 // If the parameter is a return value, |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
77 if (is_return_type()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
78 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
79 // Allocate device memory for T_INT return value pointer on device. Size in bytes |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
80 int status = gpu::Ptx::_cuda_cu_memalloc(&_dev_return_value, T_FLOAT_BYTE_SIZE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
81 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
82 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
83 _success = false; |
11894
c7abc8411011
Fixed BasicPTXTest and IntegerPTXTest
Morris Meyer <morris.meyer@oracle.com>
parents:
11821
diff
changeset
|
84 return; |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
85 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
86 // Push _dev_return_value to _kernelBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
87 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _dev_return_value; |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
88 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
89 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
90 _bufferOffset += sizeof(_dev_return_value); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
91 } else { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
92 // Get the next java argument and its value which should be a T_FLOAT |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
93 oop arg = next_arg(T_FLOAT); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
94 // Copy the java argument value to kernelArgBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
95 jvalue floatval; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
96 if (java_lang_boxing_object::get_value(arg, &floatval) != T_FLOAT) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
97 tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_FLOAT"); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
98 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
99 return; |
11894
c7abc8411011
Fixed BasicPTXTest and IntegerPTXTest
Morris Meyer <morris.meyer@oracle.com>
parents:
11821
diff
changeset
|
100 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
101 if (is_kernel_arg_setup()) { |
12545
11b086b1bae4
[PTX] fix warnings in ptx code
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12519
diff
changeset
|
102 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = (gpu::Ptx::CUdeviceptr) floatval.f; |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
103 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
104 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
105 _bufferOffset += sizeof(floatval.f); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
106 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
107 return; |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
108 } |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
109 |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11901
diff
changeset
|
110 void PTXKernelArguments::do_double() { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
111 // If the parameter is a return value, |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
112 jvalue doubleval; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
113 if (is_return_type()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
114 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
115 // Allocate device memory for T_INT return value pointer on device. Size in bytes |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
116 int status = gpu::Ptx::_cuda_cu_memalloc(&_dev_return_value, T_DOUBLE_BYTE_SIZE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
117 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
118 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
119 _success = false; |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11901
diff
changeset
|
120 return; |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
121 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
122 // Push _dev_return_value to _kernelBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
123 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _dev_return_value; |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11901
diff
changeset
|
124 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
125 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
126 _bufferOffset += sizeof(doubleval.d); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
127 } else { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
128 // Get the next java argument and its value which should be a T_INT |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
129 oop arg = next_arg(T_FLOAT); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
130 // Copy the java argument value to kernelArgBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
131 if (java_lang_boxing_object::get_value(arg, &doubleval) != T_DOUBLE) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
132 tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_INT"); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
133 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
134 return; |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11901
diff
changeset
|
135 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
136 if (is_kernel_arg_setup()) { |
12545
11b086b1bae4
[PTX] fix warnings in ptx code
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12519
diff
changeset
|
137 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = (gpu::Ptx::CUdeviceptr) doubleval.d; |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
138 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
139 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
140 _bufferOffset += sizeof(doubleval.d); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
141 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
142 return; |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11901
diff
changeset
|
143 } |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11901
diff
changeset
|
144 |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
145 void PTXKernelArguments::do_long() { |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
11485
diff
changeset
|
146 // If the parameter is a return value, |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
147 if (is_return_type()) { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
148 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
149 // Allocate device memory for T_LONG return value pointer on device. Size in bytes |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
150 int status = gpu::Ptx::_cuda_cu_memalloc(&_dev_return_value, T_LONG_BYTE_SIZE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
151 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
152 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
153 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
154 return; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
155 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
156 // Push _dev_return_value to _kernelBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
157 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _dev_return_value; |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
158 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
159 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
160 _bufferOffset += sizeof(_dev_return_value); |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
161 } else { |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
162 // Get the next java argument and its value which should be a T_LONG |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
163 oop arg = next_arg(T_LONG); |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
164 // Copy the java argument value to kernelArgBuffer |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
165 jvalue val; |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
166 if (java_lang_boxing_object::get_value(arg, &val) != T_LONG) { |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
167 tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_LONG"); |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
168 _success = false; |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
169 return; |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
170 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
171 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
172 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = val.j; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
173 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
174 // Advance _bufferOffset |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
175 _bufferOffset += sizeof(val.j); |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
176 } |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
177 return; |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
178 } |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
179 |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
180 void PTXKernelArguments::do_byte() { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
181 // If the parameter is a return value, |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
182 if (is_return_type()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
183 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
184 // Allocate device memory for T_BYTE return value pointer on device. Size in bytes |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
185 int status = gpu::Ptx::_cuda_cu_memalloc(&_dev_return_value, T_BYTE_SIZE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
186 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
187 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
188 _success = false; |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
189 return; |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
190 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
191 // Push _dev_return_value to _kernelBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
192 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _dev_return_value; |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
193 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
194 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
195 _bufferOffset += sizeof(_dev_return_value); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
196 } else { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
197 // Get the next java argument and its value which should be a T_BYTE |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
198 oop arg = next_arg(T_BYTE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
199 // Copy the java argument value to kernelArgBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
200 jvalue val; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
201 if (java_lang_boxing_object::get_value(arg, &val) != T_BYTE) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
202 tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_BYTE"); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
203 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
204 return; |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
205 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
206 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
207 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = val.b; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
208 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
209 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
210 _bufferOffset += sizeof(val.b); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
211 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
212 return; |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
213 } |
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
214 |
11901
61767ccd4600
PTX boolean return value, emitIntegerTestMove, warnings
Morris Meyer <morris.meyer@oracle.com>
parents:
11894
diff
changeset
|
215 void PTXKernelArguments::do_bool() { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
216 // If the parameter is a return value, |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
217 if (is_return_type()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
218 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
219 // Allocate device memory for T_BYTE return value pointer on device. Size in bytes |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
220 int status = gpu::Ptx::_cuda_cu_memalloc(&_dev_return_value, T_BOOLEAN_SIZE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
221 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
222 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
223 _success = false; |
11901
61767ccd4600
PTX boolean return value, emitIntegerTestMove, warnings
Morris Meyer <morris.meyer@oracle.com>
parents:
11894
diff
changeset
|
224 return; |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
225 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
226 // Push _dev_return_value to _kernelBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
227 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _dev_return_value; |
11901
61767ccd4600
PTX boolean return value, emitIntegerTestMove, warnings
Morris Meyer <morris.meyer@oracle.com>
parents:
11894
diff
changeset
|
228 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
229 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
230 _bufferOffset += sizeof(_dev_return_value); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
231 } else { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
232 // Get the next java argument and its value which should be a T_BYTE |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
233 oop arg = next_arg(T_BYTE); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
234 // Copy the java argument value to kernelArgBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
235 jvalue val; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
236 if (java_lang_boxing_object::get_value(arg, &val) != T_BOOLEAN) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
237 tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_BYTE"); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
238 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
239 return; |
11901
61767ccd4600
PTX boolean return value, emitIntegerTestMove, warnings
Morris Meyer <morris.meyer@oracle.com>
parents:
11894
diff
changeset
|
240 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
241 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
242 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = val.z; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
243 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
244 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
245 _bufferOffset += sizeof(val.z); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
246 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
247 return; |
11901
61767ccd4600
PTX boolean return value, emitIntegerTestMove, warnings
Morris Meyer <morris.meyer@oracle.com>
parents:
11894
diff
changeset
|
248 } |
61767ccd4600
PTX boolean return value, emitIntegerTestMove, warnings
Morris Meyer <morris.meyer@oracle.com>
parents:
11894
diff
changeset
|
249 |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
250 void PTXKernelArguments::do_array(int begin, int end) { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
251 // Get the next java argument and its value which should be a T_ARRAY |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
252 oop arg = next_arg(T_OBJECT); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
253 assert(arg->is_array(), "argument value not an array"); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
254 // Size of array argument |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
255 int argSize = arg->size() * HeapWordSize; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
256 // Device pointer to array argument. |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
257 gpu::Ptx::CUdeviceptr arrayArgOnDev; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
258 int status; |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
259 |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
260 if (is_kernel_arg_setup()) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
261 // Allocate device memory for array argument on device. Size in bytes |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
262 status = gpu::Ptx::_cuda_cu_memalloc(&arrayArgOnDev, argSize); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
263 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
264 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for array argument on device", |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
265 status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
266 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
267 return; |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
268 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
269 // Copy array argument to device |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
270 status = gpu::Ptx::_cuda_cu_memcpy_htod(arrayArgOnDev, arg, argSize); |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
271 if (status != GRAAL_CUDA_SUCCESS) { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
272 tty->print_cr("[CUDA] *** Error (%d) Failed to copy array argument content to device memory", |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
273 status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
274 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
275 return; |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
276 } |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
277 |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
278 // Push device array argument to _kernelBuffer |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
279 *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = arrayArgOnDev; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
280 } else { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
281 arrayArgOnDev = *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
282 status = gpu::Ptx::_cuda_cu_memcpy_dtoh(arg, arrayArgOnDev, argSize); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
283 if (status != GRAAL_CUDA_SUCCESS) { |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
284 tty->print_cr("[CUDA] *** Error (%d) Failed to copy array argument to host", status); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
285 _success = false; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
286 return; |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
287 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
288 } |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
289 |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
290 // Advance _bufferOffset |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
291 _bufferOffset += sizeof(arrayArgOnDev); |
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
292 return; |
11821
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
293 } |
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
294 |
d8659ad83fcc
PTX single-threaded array store, Warp annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
295 void PTXKernelArguments::do_void() { |
12519
f020e149c1b6
PTX codegen enhancements; fixes to PTX test regressions.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12360
diff
changeset
|
296 return; |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
297 } |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
298 |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
diff
changeset
|
299 // TODO implement other do_* |