inducer / inducer/loopy

Type inference failure

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

Description

Type inference on the following kernel fails with message `UnboundLocalError: local variable 'symbols_with_unavailable_types' referenced before assignment`:

```python
import pyopencl as cl
import numpy as np
import loopy as lp

ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)

prog = lp.make_kernel(
"{[i]: 0<=i<3}",
"""
<> x[i] = if(i==0, 1, if(i==1, 1.1, if(i==2, 1.11, -1))) {id=insn1}
x[i] = if(x[i]>1.1, 2, x[i]) {id=insn2,dep=insn1,dup=i}
out[i] = x[i] {dep=insn2,dup=i}
""")
evt, (out, ) = prog(queue)
```

The kernel compiles if the conditional in `insn2` is not an expression of `x[i]`, e.g.,
```
x[i] = if(1<0, 2.5, x[i]) {id=insn2,dep=insn1,dup=i}
```

This issue was revealed in `volumential`'s table building https://gitlab.tiker.net/xywei/volumential/-/jobs/305193.

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.