Mercurial > hg > truffle
comparison src/gpu/ptx/vm/gpu_ptx.hpp @ 11283:1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
author | Morris Meyer <morris.meyer@oracle.com> |
---|---|
date | Sat, 10 Aug 2013 14:38:30 -0400 |
parents | d55f24eac4b1 |
children | 4a6b03a16808 |
comparison
equal
deleted
inserted
replaced
11282:12661a449226 | 11283:1cd1f8ff70a1 |
---|---|
28 /* | 28 /* |
29 * Some useful macro definitions from publicly available cuda.h. | 29 * Some useful macro definitions from publicly available cuda.h. |
30 * These definitions are for convenience. | 30 * These definitions are for convenience. |
31 */ | 31 */ |
32 #define GRAAL_CUDA_SUCCESS 0 | 32 #define GRAAL_CUDA_SUCCESS 0 |
33 /**< Device shares a unified address space with the host */ | |
34 #define GRAAL_CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING 41 | |
33 #define GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR 75 | 35 #define GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR 75 |
34 #define GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR 76 | 36 #define GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR 76 |
35 #define GRAAL_CU_JIT_MAX_REGISTERS 0 | 37 #define GRAAL_CU_JIT_MAX_REGISTERS 0 |
36 #define GRAAL_CU_JIT_THREADS_PER_BLOCK 1 | 38 #define GRAAL_CU_JIT_THREADS_PER_BLOCK 1 |
37 #define GRAAL_CU_JIT_INFO_LOG_BUFFER 3 | 39 #define GRAAL_CU_JIT_INFO_LOG_BUFFER 3 |
38 #define GRAAL_CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES 4 | 40 #define GRAAL_CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES 4 |
39 #define GRAAL_CUDA_ERROR_NO_BINARY_FOR_GPU 209 | 41 #define GRAAL_CUDA_ERROR_NO_BINARY_FOR_GPU 209 |
40 | 42 |
43 /** | |
44 * End of array terminator for the extra parameter to | |
45 * ::cuLaunchKernel | |
46 */ | |
47 #define GRAAL_CU_LAUNCH_PARAM_END ((void*)0x00) | |
48 | |
49 /** | |
50 * Indicator that the next value in the extra parameter to | |
51 * ::cuLaunchKernel will be a pointer to a buffer containing all kernel | |
52 * parameters used for launching kernel f. This buffer needs to | |
53 * honor all alignment/padding requirements of the individual parameters. | |
54 * If ::GRAAL_CU_LAUNCH_PARAM_BUFFER_SIZE is not also specified in the | |
55 * extra array, then ::GRAAL_CU_LAUNCH_PARAM_BUFFER_POINTER will have no | |
56 * effect. | |
57 */ | |
58 #define GRAAL_CU_LAUNCH_PARAM_BUFFER_POINTER ((void*)0x01) | |
59 | |
60 /** | |
61 * Indicator that the next value in the extra parameter to | |
62 * ::cuLaunchKernel will be a pointer to a size_t which contains the | |
63 * size of the buffer specified with ::GRAAL_CU_LAUNCH_PARAM_BUFFER_POINTER. | |
64 * It is required that ::GRAAL_CU_LAUNCH_PARAM_BUFFER_POINTER also be specified | |
65 * in the extra array if the value associated with | |
66 * ::GRAAL_CU_LAUNCH_PARAM_BUFFER_SIZE is not zero. | |
67 */ | |
68 #define GRAAL_CU_LAUNCH_PARAM_BUFFER_SIZE ((void*)0x02) | |
69 | |
41 class Ptx { | 70 class Ptx { |
42 friend class gpu; | 71 friend class gpu; |
43 | 72 |
44 protected: | 73 protected: |
45 static bool probe_linkage(); | 74 static bool probe_linkage(); |
46 static bool initialize_gpu(); | 75 static bool initialize_gpu(); |
47 static void * generate_kernel(unsigned char *code, int code_len, const char *name); | 76 static void * generate_kernel(unsigned char *code, int code_len, const char *name); |
48 static bool execute_kernel(address kernel); | 77 static bool execute_kernel(address kernel, JavaCallArguments *); |
49 | 78 |
50 private: | 79 private: |
51 typedef int (*cuda_cu_init_func_t)(unsigned int); | 80 typedef int (*cuda_cu_init_func_t)(unsigned int); |
52 typedef int (*cuda_cu_ctx_create_func_t)(void *, int, int); | 81 typedef int (*cuda_cu_ctx_create_func_t)(void *, int, int); |
53 typedef int (*cuda_cu_ctx_detach_func_t)(int *); | 82 typedef int (*cuda_cu_ctx_detach_func_t)(int *); |