Tagging an iname causes random numerical error
The issue concerns a kernel that evaluates an expression at each point in target_points
.
---------------------------------------------------------------------------
KERNEL: eval_expr
---------------------------------------------------------------------------
ARGUMENTS:
I: ValueArg, type: <auto/runtime>
expr_val: type: <auto/runtime>, shape: () aspace: global
k_p: ValueArg, type: <auto/runtime>
k_t: ValueArg, type: <auto/runtime>
n_targets: ValueArg, type: np:dtype('int32')
result: type: <auto/runtime>, shape: (n_targets), dim_tags: (N0:stride:1) aspace: global
target_points: type: np:dtype('float64'), shape: (2, n_targets), dim_tags: (N1:stride:n_targets, N0:stride:1) aspace: global
---------------------------------------------------------------------------
DOMAINS:
[n_targets] -> { [itgt] : 0 <= itgt < n_targets }
---------------------------------------------------------------------------
INAME IMPLEMENTATION TAGS:
itgt: None
---------------------------------------------------------------------------
TEMPORARIES:
cse_exprhank1_01_result: type: <auto/runtime>, shape: () scope:auto
cse_exprhank1_01_result_0: type: <auto/runtime>, shape: () scope:auto
x0: type: <auto/runtime>, shape: () scope:auto
x1: type: <auto/runtime>, shape: () scope:auto
---------------------------------------------------------------------------
INSTRUCTIONS:
for itgt
↱ x0 = target_points[0, itgt] {id=insn}
│↱ x1 = target_points[1, itgt] {id=insn_0}
├├↱ cse_exprhank1_01_result = hank1_01(k_t*sqrt((x0 + -1.23)*(x0 + -1.23) + x1*x1)).order0 {id=insn_1}
└└│↱ cse_exprhank1_01_result_0 = hank1_01(k_p*sqrt((x0 + -1.23)*(x0 + -1.23) + x1*x1)).order0 {id=insn_2}
↱ └└ expr_val = cse_exprhank1_01_result*(I / 4) + cse_exprhank1_01_result_0*(I / 4) {id=insn_3}
└ result[itgt] = expr_val {id=insn_4}
end itgt
---------------------------------------------------------------------------
The kernel works fine; however, results become corrupt at random points after tagging the iname itgt
with g.0
.
I am running on pocl=1.5=hb5afada_9
from conda-forge
.
python expr_eval_issue.py
Choose platform:
[0] <pyopencl.Platform 'Portable Computing Language' at 0x7efec30f8008>
Choice [0]:
Set the environment variable PYOPENCL_CTX='' to avoid being asked again.
number of bad points = 157 max diff = 0.6011784136710799
number of bad points = 45 max diff = 0.341115693625739
number of bad points = 130 max diff = 0.5037041917858311
number of bad points = 0 max diff = 0.0
number of bad points = 64 max diff = 0.16278290190910377
number of bad points = 0 max diff = 0.0
number of bad points = 6 max diff = 0.03901625426315815
number of bad points = 53 max diff = 0.09377962115644535
number of bad points = 14 max diff = 0.012081748205180577
number of bad points = 34 max diff = 0.0066656891572988465
Here is the pickled kernel: kernel.pkl
And a script to reproduce the issue: expr_eval_issue.py
Edited by Xiaoyu Wei