inducer / inducer/loopy

precompute() calls in test_tim2d lead to unused inames

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

Description

These two precompute calls are from [test_tim2d()](https://github.com/inducer/loopy/blob/a9940db33d17e180efbd61c47c086a81bf7733ce/test/test_sem_reagan.py#L37) in [test_sem_reagan.py](https://github.com/inducer/loopy/blob/master/test/test_sem_reagan.py):
```
knl = lp.precompute(knl, "ur(m,j)", ["m", "j"], default_tag="l.auto")
# ^this adds inames `a` and `b` which will become unused inames
knl = lp.precompute(knl, "us(i,m)", ["i", "m"], default_tag="l.auto")
# ^this makes inames `a` and `b` unused inames
```
After these two calls, we're left with two unused inames, `a`, and `b`. I'm not sure that this is intended behavior, and unused inames will soon be disallowed when linearizing (scheduling) kernels.

Here's a full snippet that reproduces the test kernel and also prints out the used/unused inames before/after these calls:
```
import loopy as lp
import numpy as np
import pyopencl as cl
from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa

lp.set_caching_enabled(False)

def get_used_inames(knl):
import loopy as lp
exp_knl = lp.expand_subst(knl)

used_inames = set()
for insn in exp_knl.instructions:
used_inames.update(
exp_knl.insn_inames(insn.id)
| insn.reduction_inames())

return used_inames

# example kernel from test_sem_regen.py->test_tim2d()

dtype = np.float32
order = "C"
n = 8

from pymbolic import var
K_sym = var("K") # noqa

field_shape = (K_sym, n, n)

# K - run-time symbolic
knl = lp.make_kernel(
"{[i,j,e,m,o,o2]: 0<=i,j,m,o,o2

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.