Skip to content

Commit 8bde362

Browse files
Fixed passing arrays for spmd kernels.
Do not assign new dtype value for device symbols via get_type function. Use macros PASSBYVALP PASSBYREFP instead. Remove hack for load/store of the last symbol. Signed-off-by: Dominik Adamski <[email protected]>
1 parent b39a6ff commit 8bde362

File tree

2 files changed

+14
-29
lines changed

2 files changed

+14
-29
lines changed

tools/flang2/flang2exe/kmpcutil.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,16 +1783,6 @@ ll_make_kmpc_parallel_51(int global_tid_sptr, std::vector<int> &symbols, SPTR he
17831783
DT_INT8,
17841784
nme_args,
17851785
ad_acon(captured_vars, i * TARGET_PTRSIZE));
1786-
// Hack for correct generation of *.ll code ( perform load operation instead of raw bitcast)
1787-
if (i == n_symbols - 1) {
1788-
chk_block(ilix);
1789-
ilix = mk_ompaccel_ldsptr(ompaccel_tinfo_get(gbl.currsub)->symbols[i].device_sym);
1790-
ilix = mk_ompaccel_store(ilix,
1791-
DT_INT8,
1792-
nme_args,
1793-
ad_acon(captured_vars, i * TARGET_PTRSIZE));
1794-
1795-
}
17961786
}
17971787
chk_block(ilix);
17981788
}

tools/flang2/flang2exe/outliner.cpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -505,19 +505,24 @@ ll_make_ftn_outlined_params(int func_sptr, int paramct, DTYPE *argtype, OMPACCEL
505505
argtype++;
506506
STYPEP(sym, ST_VAR);
507507
aux.dpdsc_base[dpdscp++] = sym;
508+
//AOC begin
508509
if (current_tinfo)
509510
{
510511
NEED((current_tinfo->n_symbols + 1), current_tinfo->symbols, OMPACCEL_SYM,
511512
current_tinfo->sz_symbols, current_tinfo->sz_symbols * 2);
512-
if (cnt >= 2)
513+
current_tinfo->symbols[current_tinfo->n_symbols].device_sym = static_cast<SPTR>(sym);
514+
if (cnt >= 2) {
515+
PASSBYVALP(sym, false);
516+
PASSBYREFP(sym, true);
513517
current_tinfo->symbols[current_tinfo->n_symbols].host_sym =
514518
ompaccel_tinfo_get(gbl.currsub)->symbols[cnt-2].device_sym;
515-
current_tinfo->symbols[current_tinfo->n_symbols].device_sym = static_cast<SPTR>(sym);
516-
current_tinfo->symbols[current_tinfo->n_symbols].map_type = 0;
517-
current_tinfo->symbols[current_tinfo->n_symbols].in_map = 0; // AOCC
518-
current_tinfo->n_symbols++;
519-
cnt++;
519+
}
520+
current_tinfo->symbols[current_tinfo->n_symbols].map_type = 0;
521+
current_tinfo->symbols[current_tinfo->n_symbols].in_map = 0;
522+
current_tinfo->n_symbols++;
523+
cnt++;
520524
}
525+
//AOCC end
521526
}
522527
}
523528

@@ -2443,13 +2448,6 @@ llMakeFtnOutlinedSignatureTarget(SPTR func_sptr, OMPACCEL_TINFO *current_tinfo,
24432448
sym = ompaccel_create_device_symbol(sptr, count);
24442449
count++;
24452450
current_tinfo->symbols[i].device_sym = sym;
2446-
if (is_SPMD_mode(current_tinfo->mode) && DTYPEG(sym) != DT_INT8)
2447-
{
2448-
PASSBYVALP(sym, 1);
2449-
DTYPEP(sym, get_type(2, TY_PTR, DTYPEG(sym)));
2450-
} else {
2451-
PASSBYVALP(sym, 0);
2452-
}
24532451
OMPACCDEVSYMP(sym, TRUE);
24542452
aux.dpdsc_base[dpdscp++] = sym;
24552453
}
@@ -2685,11 +2683,8 @@ ll_make_helper_function_for_kmpc_parallel_51(SPTR scope_sptr, OMPACCEL_TINFO *or
26852683
func_args[1] = get_type(2, TY_PTR, DT_INT8);//DT_CPTR; // bound_tid
26862684

26872685
for (int k = 2; k < func_args_cnt; k++) {
2688-
if (DTYPEG(symbols->device_sym) == DT_INT8 ) {
2689-
func_args[k] = get_type(2, TY_PTR, DT_INT8);
2690-
}
2691-
else {
2692-
func_args[k] = DTYPEG(symbols->device_sym);}
2686+
func_args[k] = DTYPEG(symbols->device_sym);
2687+
PASSBYVALP(symbols->device_sym, false);
26932688
symbols++;
26942689
}
26952690

@@ -2709,7 +2704,7 @@ ll_make_helper_function_for_kmpc_parallel_51(SPTR scope_sptr, OMPACCEL_TINFO *or
27092704
OMPACCFUNCDEVP(func_sptr, 1);
27102705
current_tinfo = ompaccel_tinfo_create(func_sptr, max_nargs);
27112706
ll_make_ftn_outlined_params(func_sptr, func_args_cnt, func_args.data(), current_tinfo);
2712-
ll_process_routine_parameters(func_sptr);
2707+
ll_process_routine_parameters(func_sptr);
27132708
return func_sptr;
27142709
}
27152710

0 commit comments

Comments
 (0)