Skip to content

Commit

Permalink
unsafe atomic adds for float/double only
Browse files Browse the repository at this point in the history
  • Loading branch information
reguly committed Oct 10, 2023
1 parent eb7cbe6 commit 45d6097
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions translator/c/op2_gen_cuda_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down Expand Up @@ -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],<ARG>_l['+str(d)+']);')
Expand Down

0 comments on commit 45d6097

Please sign in to comment.