inducer / inducer/loopy

Temporary Array Arg is apparently accessed out of bounds

Open
#177 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
636
Forks
81
Avg merge
1d 19h
Merged PRs (30d)
7

Description

Assume this kernel:

```
a = rng.random((5,5))
b = rng.random((5,5))
c = np.zeros((5,5),dtype=np.float64)
n = 5
k = 5
m = 5
knl = lp.make_kernel(
[
"{ [i] : 0 <= i < n }",
"{ [j] : 0 <= j < m }",
"{ [l] : 0 <= l < k }"],
"""
for i
for j
A_i[j]=a[i,j]
end
for l
B_i[l]=b[l,i]
end
out[i,j] = out[i,j] + A_i[i] * B_i[j]
end
""",[
lp.GlobalArg("a", shape=(n,n), dtype=np.float64),
lp.GlobalArg("b", shape=(m,m),dtype=np.float64),
lp.GlobalArg("out", shape=(n,m),dtype=np.float64),
lp.TemporaryVariable("A_i",shape=(m,),dtype=np.float64),
lp.TemporaryVariable("B_i",shape=(k,),dtype=np.float64),
lp.ValueArg("n,m,k",dtype=np.int32,approximately=5)
])
evt, (out,) = knl(queue,a=a,b=b,out=c)
```
Will throw ``loopy.diagnostic.LoopyError: 'A_i[j]' in instruction 'insn' accesses out-of-bounds array element``
for no apparent reason. A_i is defined with shape=(m,) and is only accessed by index j which runs from 0 to m, so exactly once through the array. This seems like a bug?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.