From 45d6097c4f75ec9fa839df632b5e99f36354d9d9 Mon Sep 17 00:00:00 2001 From: Reguly Reguly Date: Tue, 10 Oct 2023 15:49:07 +0300 Subject: [PATCH] unsafe atomic adds for float/double only --- translator/c/op2_gen_cuda_simple.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translator/c/op2_gen_cuda_simple.py b/translator/c/op2_gen_cuda_simple.py index 09c646025..312857a22 100644 --- a/translator/c/op2_gen_cuda_simple.py +++ b/translator/c/op2_gen_cuda_simple.py @@ -118,8 +118,8 @@ def op2_gen_cuda_simple(master, date, consts, kernels,sets, macro_defs, hip = 0) #Optimization settings inc_stage=0 - op_color2_force=1 - atomics=0 + op_color2_force=0 + atomics=1 name, nargs, dims, maps, var, typs, accs, idxs, inds, soaflags, optflags, decl_filepath, \ @@ -766,7 +766,7 @@ def op2_gen_cuda_simple(master, date, consts, kernels,sets, macro_defs, hip = 0) IF('optflags & 1<<'+str(optidxs[g_m])) for d in range(0,int(dims[g_m])): atomicAdd = 'atomicAdd' - if hip == 1: + if hip == 1 and (typs[g_m]=='float' or typs[g_m]=='double'): atomicAdd = 'unsafeAtomicAdd' if soaflags[g_m]: code(atomicAdd+'(&ind_arg'+str(inds[g_m]-1)+'['+str(d)+'*'+op2_gen_common.get_stride_string(g_m,maps,mapnames,name)+'+map'+str(mapinds[g_m])+'idx],_l['+str(d)+']);')