Skip to content
Commit 5afb9fb2 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Merge branch 'elif-else' into 'master'

Elif else updates

Migrating pull request from https://github.com/inducer/loopy/pull/65 to gitlab by request

Note: issue brought up on github is still open:

@inducer there is a bug in here I can't quite figure out.  In the test added in 8e8bd1d0, the generated wrapper reads as:

```
def _lpy_host_loopy_kernel(_lpy_cl_kernels, queue, a, wait_for=None, allocator=None):
    from struct import pack as _lpy_pack
    import pyopencl as _lpy_cl
    import pyopencl.tools

    if allocator is None:
        allocator = _lpy_cl_tools.DeferredAllocator(queue.context)


    _global_temporaries = []

    if (i % 2) == 0:
        pass
        # {{{ enqueue loopy_kernel

        _lpy_knl = _lpy_cl_kernels.loopy_kernel
        assert _lpy_knl.num_args == 1

        pass
        _lpy_knl.set_arg(0, a)
        _lpy_evt = _lpy_cl.enqueue_nd_range_kernel(queue, _lpy_knl, (1,), (1,),  wait_for=wait_for, g_times_l=True)
        wait_for = [_lpy_evt]

        # }}}


    for _tv in _global_temporaries:
        _tv.release()

    return _lpy_evt
```

Note the `if (i %2) == 0:` in there!  `i` is not defined, this causes an error on execution, I am not sure how it get introduced into the wrapper at all.

Note that the test isn't fully correct either (I didn't bother to finish it as I couldn't figure out where the wrapper error was coming from)

See merge request !43
parents da66f139 264ddadd
Pipeline #3432 passed with stage
in 22 minutes and 54 seconds