Mercurial > hg > graal-jvmci-8
comparison src/gpu/hsail/vm/gpu_hsail.cpp @ 16795:a29e6e7b7a86
Replace hsail donor threads with hsail tlabs
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 12 Aug 2014 16:30:17 -0700 |
parents | a18c229b9a0b |
children | bbb987aec58d |
comparison
equal
deleted
inserted
replaced
16794:74c02c90a3f9 | 16795:a29e6e7b7a86 |
---|---|
64 #define HS_NMETHOD "Lcom/oracle/graal/hotspot/meta/HotSpotNmethod;" | 64 #define HS_NMETHOD "Lcom/oracle/graal/hotspot/meta/HotSpotNmethod;" |
65 | 65 |
66 JNINativeMethod Hsail::HSAIL_methods[] = { | 66 JNINativeMethod Hsail::HSAIL_methods[] = { |
67 {CC"initialize", CC"()Z", FN_PTR(Hsail::initialize)}, | 67 {CC"initialize", CC"()Z", FN_PTR(Hsail::initialize)}, |
68 {CC"generateKernel", CC"([B" STRING ")J", FN_PTR(Hsail::generate_kernel)}, | 68 {CC"generateKernel", CC"([B" STRING ")J", FN_PTR(Hsail::generate_kernel)}, |
69 {CC"executeKernel0", CC"("HS_INSTALLED_CODE"I["OBJECT"["JLTHREAD"I[I)Z", FN_PTR(Hsail::execute_kernel_void_1d)}, | 69 {CC"executeKernel0", CC"("HS_INSTALLED_CODE"I["OBJECT"II[I)Z", FN_PTR(Hsail::execute_kernel_void_1d)}, |
70 }; | 70 }; |
71 | 71 |
72 void* Hsail::_device_context = NULL; | 72 void* Hsail::_device_context = NULL; |
73 jint Hsail::_notice_safepoints = false; | 73 jint Hsail::_notice_safepoints = false; |
74 | 74 |
98 void Hsail::ignore_safepoints() { | 98 void Hsail::ignore_safepoints() { |
99 _notice_safepoints = false; | 99 _notice_safepoints = false; |
100 } | 100 } |
101 | 101 |
102 GPU_VMENTRY(jboolean, Hsail::execute_kernel_void_1d, (JNIEnv* env, jclass, jobject kernel_handle, jint dimX, jobject args, | 102 GPU_VMENTRY(jboolean, Hsail::execute_kernel_void_1d, (JNIEnv* env, jclass, jobject kernel_handle, jint dimX, jobject args, |
103 jobject donor_threads, jint allocBytesPerWorkitem, jobject oop_map_array)) | 103 jint num_tlabs, jint allocBytesPerWorkitem, jobject oop_map_array)) |
104 | 104 |
105 ResourceMark rm; | 105 ResourceMark rm; |
106 jlong nmethodValue = InstalledCode::address(kernel_handle); | 106 jlong nmethodValue = InstalledCode::address(kernel_handle); |
107 if (nmethodValue == 0) { | 107 if (nmethodValue == 0) { |
108 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); | 108 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); |
114 void* kernel = (void*) HotSpotInstalledCode::codeStart(kernel_handle); | 114 void* kernel = (void*) HotSpotInstalledCode::codeStart(kernel_handle); |
115 if (kernel == NULL) { | 115 if (kernel == NULL) { |
116 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); | 116 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); |
117 } | 117 } |
118 | 118 |
119 return execute_kernel_void_1d_internal((address) kernel, dimX, args, mh, nm, donor_threads, allocBytesPerWorkitem, oop_map_array, CHECK_0); | 119 return execute_kernel_void_1d_internal((address) kernel, dimX, args, mh, nm, num_tlabs, allocBytesPerWorkitem, oop_map_array, CHECK_0); |
120 GPU_END | 120 GPU_END |
121 | 121 |
122 static void showRanges(jboolean* a, int len) { | 122 static void showRanges(jboolean* a, int len) { |
123 // show ranges | 123 // show ranges |
124 bool lookFor = true; | 124 bool lookFor = true; |
135 tty->print_cr("-%d", len-1); | 135 tty->print_cr("-%d", len-1); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 jboolean Hsail::execute_kernel_void_1d_internal(address kernel, int dimX, jobject args, methodHandle& mh, nmethod* nm, | 139 jboolean Hsail::execute_kernel_void_1d_internal(address kernel, int dimX, jobject args, methodHandle& mh, nmethod* nm, |
140 jobject donor_threads, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) { | 140 jint num_tlabs, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) { |
141 ResourceMark rm(THREAD); | 141 ResourceMark rm(THREAD); |
142 objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args); | 142 objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args); |
143 assert(THREAD->is_Java_thread(), "must be a JavaThread"); | 143 assert(THREAD->is_Java_thread(), "must be a JavaThread"); |
144 | 144 |
145 // We avoid HSAILAllocationInfo logic if kernel does not allocate | 145 // We avoid HSAILAllocationInfo logic if kernel does not allocate |
146 // in which case the donor_thread array passed in will be null | 146 // in which case the num_tlabs passed in will be 0 |
147 HSAILAllocationInfo* allocInfo = (donor_threads == NULL ? NULL : new HSAILAllocationInfo(donor_threads, dimX, allocBytesPerWorkitem)); | 147 HSAILAllocationInfo* allocInfo = (num_tlabs == 0 ? NULL : new HSAILAllocationInfo(num_tlabs, dimX, allocBytesPerWorkitem)); |
148 | 148 |
149 // Reset the kernel arguments | 149 // Reset the kernel arguments |
150 _okra_clear_args(kernel); | 150 _okra_clear_args(kernel); |
151 | 151 |
152 JavaThread* thread = (JavaThread*)THREAD; | 152 JavaThread* thread = (JavaThread*)THREAD; |