Mercurial > hg > truffle
comparison src/gpu/ptx/vm/ptxKernelArguments.hpp @ 12566:c17bfad2fa98
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 24 Oct 2013 15:56:08 +0200 |
parents | f020e149c1b6 |
children | 1a7e7011a341 |
comparison
equal
deleted
inserted
replaced
12565:e47f373499ec | 12566:c17bfad2fa98 |
---|---|
40 public: | 40 public: |
41 // Buffer holding CUdeviceptr values that represent the kernel arguments | 41 // Buffer holding CUdeviceptr values that represent the kernel arguments |
42 char _kernelArgBuffer[1024]; | 42 char _kernelArgBuffer[1024]; |
43 // Current offset into _kernelArgBuffer | 43 // Current offset into _kernelArgBuffer |
44 size_t _bufferOffset; | 44 size_t _bufferOffset; |
45 gpu::Ptx::CUdeviceptr _return_value_ptr; | 45 // Device pointer holding return value |
46 gpu::Ptx::CUdeviceptr _dev_return_value; | |
47 | |
48 // Indicates if signature iteration is being done during kernel | |
49 // setup i.e., java arguments are being copied to device pointers. | |
50 bool _kernelArgSetup; | |
51 | |
46 private: | 52 private: |
47 // Array of java argument oops | 53 // Array of java argument oops |
48 arrayOop _args; | 54 arrayOop _args; |
49 // Current index into _args | 55 // Current index into _args |
50 int _index; | 56 int _index; |
51 // Flag to indicate successful creation of kernel argument buffer | 57 // Flag to indicate successful creation of kernel argument buffer |
52 bool _success; | 58 bool _success; |
53 | 59 |
54 bool _afterInvoocation; | |
55 // Get next java argument | 60 // Get next java argument |
56 oop next_arg(BasicType expectedType); | 61 oop next_arg(BasicType expectedType); |
57 | 62 |
58 public: | 63 public: |
59 PTXKernelArguments(Symbol* signature, arrayOop args, bool is_static) : SignatureIterator(signature) { | 64 PTXKernelArguments(Symbol* signature, arrayOop args, bool is_static) : SignatureIterator(signature) { |
60 this->_return_type = T_ILLEGAL; | 65 this->_return_type = T_ILLEGAL; |
61 _index = 0; | 66 _index = 0; |
62 _args = args; | 67 _args = args; |
63 _success = true; | 68 _success = true; |
64 _bufferOffset = 0; | 69 _bufferOffset = 0; |
65 _return_value_ptr = 0; | 70 _dev_return_value = 0; |
71 _kernelArgSetup = true; | |
72 //_dev_call_by_reference_args_index = 0; | |
66 if (!is_static) { | 73 if (!is_static) { |
67 // TODO : Create a device argument for receiver object and add it to _kernelBuffer | 74 // TODO : Create a device argument for receiver object and add it to _kernelBuffer |
68 tty->print_cr("{CUDA] ****** TODO: Support for execution of non-static java methods not implemented yet."); | 75 tty->print_cr("{CUDA] ****** TODO: Support for execution of non-static java methods not implemented yet."); |
69 } | 76 } |
70 // Iterate over the entire signature | 77 // Iterate over the entire signature |
78 | 85 |
79 inline size_t device_argument_buffer_size() { | 86 inline size_t device_argument_buffer_size() { |
80 return _bufferOffset; | 87 return _bufferOffset; |
81 } | 88 } |
82 | 89 |
83 void reiterate() { | 90 void copyRefArgsFromDtoH() { |
84 _afterInvoocation = true; | 91 _kernelArgSetup = false; |
85 _bufferOffset = 0; | 92 _bufferOffset = 0; |
86 _index = 0; | 93 _index = 0; |
87 iterate(); | 94 iterate(); |
88 } | 95 } |
89 | 96 |
90 inline bool is_after_invocation() { | 97 inline bool is_kernel_arg_setup() { |
91 return _afterInvoocation; | 98 return _kernelArgSetup; |
92 } | 99 } |
93 | 100 |
94 // Get the return oop value | 101 // Get the return oop value |
95 oop get_return_oop(); | 102 oop get_return_oop(); |
96 | 103 |
97 // get device return value ptr | 104 // get device return value ptr |
98 gpu::Ptx::CUdeviceptr get_return_value_ptr() { | 105 gpu::Ptx::CUdeviceptr get_dev_return_value() { |
99 return _return_value_ptr; | 106 return _dev_return_value; |
100 } | 107 } |
101 | 108 |
102 | 109 |
103 void do_byte(); | 110 void do_byte(); |
104 void do_bool(); | 111 void do_bool(); |