inducer / inducer/loopy

What to do about separate "loop entry roots" sharing a domain

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

Description

Consider:
```python
knl = lp.make_kernel(
"{[i,j, l]: 0<=i<20 and 0<=j<=i and 0<=l<10}",
"""
z[l] = l
y[i,j] = i+j
""")
knl = lp.tag_inames(knl, "i:g.0, l:g.0")

print(lp.generate_code_v2(knl).device_code())
```
generates the code:
```c
__kernel void __attribute__ ((reqd_work_group_size(1, 1, 1))) loopy_kernel(__global int *__restrict__ y, __global int *__restrict__ z)
{
if (9 + -1 * gid(0) >= 0)
z[gid(0)] = gid(0);
for (int j = 0; j <= gid(0); ++j)
y[20 * gid(0) + j] = gid(0) + j;
}
```

From #127 it was established that an instance of an instruction would be entered iff the domain it's inames are part of are all non-empty. Which is why I would have expected the generated code to be:

```c
__kernel void __attribute__ ((reqd_work_group_size(1, 1, 1))) loopy_kernel(__global int *__restrict__ y, __global int *__restrict__ z)
{
if (9 + -1 * gid(0) >= 0)
z[gid(0)] = gid(0);
if (9 + -1 * gid(0) >= 0)
for (int j = 0; j <= gid(0); ++j)
y[20 * gid(0) + j] = gid(0) + j;
}
```

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.