comparison src/gpu/hsail/vm/gpu_hsail.hpp @ 13819:49db2c1e3bee

added support for co-existing GPU backends (JBS:GRAAL-1)
author Doug Simon <doug.simon@oracle.com>
date Thu, 30 Jan 2014 00:52:33 +0100
parents bfd61161d752
children 8053c3ede984
comparison
equal deleted inserted replaced
13818:d2f520f46180 13819:49db2c1e3bee
24 24
25 #ifndef GPU_HSAIL_HPP 25 #ifndef GPU_HSAIL_HPP
26 #define GPU_HSAIL_HPP 26 #define GPU_HSAIL_HPP
27 27
28 class Hsail { 28 class Hsail {
29 friend class gpu;
30 29
31 protected: 30 private:
32 static bool probe_linkage(); 31
33 static bool initialize_gpu(); 32 static JNINativeMethod HSAIL_methods[];
34 static unsigned int total_cores(); 33
35 static void* generate_kernel(unsigned char *code, int code_len, const char *name); 34 // static native boolean initialize();
36 static bool execute_kernel_void_1d(address kernel, int dimX, jobject args, methodHandle& mh); 35 static jboolean initialize(JNIEnv *env, jclass);
36
37 // static native long generateKernel(byte[] targetCode, String name);
38 static jlong generate_kernel(JNIEnv *env, jclass, jbyteArray code_handle, jstring name_handle);
39
40 // static native boolean executeKernel0(HotSpotInstalledCode kernel, int jobSize, Object[] args);
41 static jboolean execute_kernel_void_1d(JNIEnv *env, jclass, jobject hotspotInstalledCode, jint dimX, jobject args);
42
37 static void register_heap(); 43 static void register_heap();
38 44
39 public: 45 public:
46
47 // Registers the implementations for the native methods in HSAILHotSpotBackend
48 static bool register_natives(JNIEnv* env);
49
40 #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) 50 #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
41 typedef unsigned long long CUdeviceptr; 51 typedef unsigned long long CUdeviceptr;
42 #else 52 #else
43 typedef unsigned int CUdeviceptr; 53 typedef unsigned int CUdeviceptr;
44 #endif 54 #endif
55 typedef bool (*okra_push_long_func_t)(void*, jlong); 65 typedef bool (*okra_push_long_func_t)(void*, jlong);
56 typedef bool (*okra_execute_with_range_func_t)(void*, jint); 66 typedef bool (*okra_execute_with_range_func_t)(void*, jint);
57 typedef bool (*okra_clearargs_func_t)(void*); 67 typedef bool (*okra_clearargs_func_t)(void*);
58 typedef bool (*okra_register_heap_func_t)(void*, size_t); 68 typedef bool (*okra_register_heap_func_t)(void*, size_t);
59 69
60 static bool probe_linkage_internal(bool isRequired);
61
62 public: 70 public:
63 static okra_create_context_func_t _okra_create_context; 71 static okra_create_context_func_t _okra_create_context;
64 static okra_create_kernel_func_t _okra_create_kernel; 72 static okra_create_kernel_func_t _okra_create_kernel;
65 static okra_push_object_func_t _okra_push_object; 73 static okra_push_object_func_t _okra_push_object;
66 static okra_push_boolean_func_t _okra_push_boolean; 74 static okra_push_boolean_func_t _okra_push_boolean;