forked from OSchip/llvm-project
[OpenMP] Part 2 of At present, amdgpu plugin merges both asynchronous
and synchronous kernel launch implementations into a single synchronous version. This patch prepares the plugin for asynchronous implementation by: Privatizing actual kernel launch code (valid in both cases) into an anonymous namespace base function (submitted at D115267) - Separating the control flow path of asynchronous and synchronous kernel launch functions** (this diff) Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D115273
This commit is contained in:
parent
2d1761bffc
commit
28309c5436
|
@ -1042,10 +1042,10 @@ static uint64_t acquire_available_packet_id(hsa_queue_t *queue) {
|
|||
return packet_id;
|
||||
}
|
||||
|
||||
int32_t __tgt_rtl_run_target_team_region_locked(
|
||||
int32_t device_id, void *tgt_entry_ptr, void **tgt_args,
|
||||
ptrdiff_t *tgt_offsets, int32_t arg_num, int32_t num_teams,
|
||||
int32_t thread_limit, uint64_t loop_tripcount) {
|
||||
int32_t runRegionLocked(int32_t device_id, void *tgt_entry_ptr, void **tgt_args,
|
||||
ptrdiff_t *tgt_offsets, int32_t arg_num,
|
||||
int32_t num_teams, int32_t thread_limit,
|
||||
uint64_t loop_tripcount) {
|
||||
// Set the context we are using
|
||||
// update thread limit content in gpu memory if un-initialized or specified
|
||||
// from host
|
||||
|
@ -2218,9 +2218,9 @@ int32_t __tgt_rtl_run_target_team_region(int32_t device_id, void *tgt_entry_ptr,
|
|||
uint64_t loop_tripcount) {
|
||||
|
||||
DeviceInfo.load_run_lock.lock_shared();
|
||||
int32_t res = __tgt_rtl_run_target_team_region_locked(
|
||||
device_id, tgt_entry_ptr, tgt_args, tgt_offsets, arg_num, num_teams,
|
||||
thread_limit, loop_tripcount);
|
||||
int32_t res =
|
||||
runRegionLocked(device_id, tgt_entry_ptr, tgt_args, tgt_offsets, arg_num,
|
||||
num_teams, thread_limit, loop_tripcount);
|
||||
|
||||
DeviceInfo.load_run_lock.unlock_shared();
|
||||
return res;
|
||||
|
@ -2238,6 +2238,20 @@ int32_t __tgt_rtl_run_target_region(int32_t device_id, void *tgt_entry_ptr,
|
|||
thread_limit, 0);
|
||||
}
|
||||
|
||||
int32_t __tgt_rtl_run_target_team_region_async(
|
||||
int32_t device_id, void *tgt_entry_ptr, void **tgt_args,
|
||||
ptrdiff_t *tgt_offsets, int32_t arg_num, int32_t num_teams,
|
||||
int32_t thread_limit, uint64_t loop_tripcount) {
|
||||
|
||||
DeviceInfo.load_run_lock.lock_shared();
|
||||
int32_t res =
|
||||
runRegionLocked(device_id, tgt_entry_ptr, tgt_args, tgt_offsets, arg_num,
|
||||
num_teams, thread_limit, loop_tripcount);
|
||||
|
||||
DeviceInfo.load_run_lock.unlock_shared();
|
||||
return res;
|
||||
}
|
||||
|
||||
int32_t __tgt_rtl_run_target_region_async(int32_t device_id,
|
||||
void *tgt_entry_ptr, void **tgt_args,
|
||||
ptrdiff_t *tgt_offsets,
|
||||
|
@ -2250,9 +2264,9 @@ int32_t __tgt_rtl_run_target_region_async(int32_t device_id,
|
|||
// fix thread num
|
||||
int32_t team_num = 1;
|
||||
int32_t thread_limit = 0; // use default
|
||||
return __tgt_rtl_run_target_team_region(device_id, tgt_entry_ptr, tgt_args,
|
||||
tgt_offsets, arg_num, team_num,
|
||||
thread_limit, 0);
|
||||
return __tgt_rtl_run_target_team_region_async(device_id, tgt_entry_ptr,
|
||||
tgt_args, tgt_offsets, arg_num,
|
||||
team_num, thread_limit, 0);
|
||||
}
|
||||
|
||||
int32_t __tgt_rtl_synchronize(int32_t device_id, __tgt_async_info *AsyncInfo) {
|
||||
|
|
Loading…
Reference in New Issue