10
10
from numba import TypingError , types
11
11
from numba .core import cgutils
12
12
from numba .cpython .unsafe .tuple import tuple_setitem
13
- from numba .extending import register_jitable
14
13
from numba .np import arrayobj
15
14
from numpy .core .numeric import normalize_axis_index , normalize_axis_tuple
16
15
@@ -500,6 +499,14 @@ def extract_array(aryty, ary):
500
499
layout = aryty .layout
501
500
return (data , shape , strides , layout )
502
501
502
+ mod = builder .module
503
+ domain = mod .add_metadata ([], self_ref = True )
504
+ input_scope = mod .add_metadata ([domain ], self_ref = True )
505
+ output_scope = mod .add_metadata ([domain ], self_ref = True )
506
+ input_scope_set = mod .add_metadata ([input_scope , output_scope ])
507
+
508
+ output_scope_set = mod .add_metadata ([input_scope , output_scope ])
509
+
503
510
inputs = [
504
511
extract_array (aryty , ary )
505
512
for aryty , ary in zip (in_types , inputs , strict = True )
@@ -544,6 +551,8 @@ def extract_array(aryty, ary):
544
551
context , builder , * array_info , idxs_bc , * safe
545
552
)
546
553
val = builder .load (ptr )
554
+ val .set_metadata ("alias.scope" , input_scope_set )
555
+ val .set_metadata ("noalias" , output_scope_set )
547
556
input_vals .append (val )
548
557
549
558
# Call scalar function
@@ -573,7 +582,9 @@ def extract_array(aryty, ary):
573
582
ptr = cgutils .get_item_pointer2 (
574
583
context , builder , * outputs [i ], idxs_bc
575
584
)
576
- builder .store (value , ptr )
585
+ store = builder .store (value , ptr )
586
+ store .set_metadata ("alias.scope" , output_scope_set )
587
+ store .set_metadata ("noalias" , input_scope_set )
577
588
578
589
# Close the loops and write accumulator values to the output arrays
579
590
for depth , loop in enumerate (loop_stack [::- 1 ]):
@@ -588,7 +599,9 @@ def extract_array(aryty, ary):
588
599
ptr = cgutils .get_item_pointer2 (
589
600
context , builder , * outputs [output ], idxs_bc
590
601
)
591
- builder .store (builder .load (accu ), ptr )
602
+ store = builder .store (builder .load (accu ), ptr )
603
+ store .set_metadata ("alias.scope" , output_scope_set )
604
+ store .set_metadata ("noalias" , input_scope_set )
592
605
loop .__exit__ (None , None , None )
593
606
return
594
607
0 commit comments