#NEWLINE# @ lower ( stubs . atomic . add , types . Array , types . intp , types . Any ) #NEWLINE# @ lower ( stubs . atomic . add , types . Array , types . UniTuple , types . Any ) #NEWLINE# @ lower ( stubs . atomic . add , types . Array , types . Tuple , types . Any ) #NEWLINE# def hsail_atomic_add_tuple( context , builder , sig , args ) : #NEWLINE# #INDENT# ( aryty , indty , valty ) = sig . args #NEWLINE# ( ary , inds , val ) = args #NEWLINE# dtype = aryty . dtype #NEWLINE# if ( indty == types . intp ) : #NEWLINE# #INDENT# indices = [ inds ] #NEWLINE# indty = [ indty ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# indices = cgutils . unpack_tuple ( builder , inds , count = len ( indty ) ) #NEWLINE# indices = [ context . cast ( builder , i , t , types . intp ) for ( t , i ) in zip ( indty , valty ) ] #NEWLINE# #UNINDENT# if ( dtype != valty ) : #NEWLINE# #INDENT# raise TypeError ( ( 'expecting %s but got %s' % ( dtype , valty ) ) ) #NEWLINE# #UNINDENT# if ( aryty . ndim != len ( indty ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'indexing %d-D array with %d-D index' % ( aryty . ndim , len ( indty ) ) ) ) #NEWLINE# #UNINDENT# lary = context . make_array ( aryty ) ( context , builder , ary ) #NEWLINE# ptr = cgutils . get_item_pointer ( builder , aryty , lary , indices ) #NEWLINE# return builder . atomic_rmw ( 'add' , ptr , val , ordering = 'monotonic' )