Skip to content

Fix code gen to respect declarator precedence#23

Merged
inducer merged 1 commit into
masterfrom
fix-declarator-precedence
Oct 1, 2019
Merged

Fix code gen to respect declarator precedence#23
inducer merged 1 commit into
masterfrom
fix-declarator-precedence

Conversation

@inducer

@inducer inducer commented Sep 30, 2019

Copy link
Copy Markdown
Owner

No description provided.

@inducer inducer merged commit 15bc65a into master Oct 1, 2019
@wence-

wence- commented Oct 2, 2019

Copy link
Copy Markdown

This broke loopy's code generation for its C target with const declared variables:

import numpy
import loopy
k = loopy.make_kernel("{ : }", "a[0] = b[0]",
                      [...],
                      temporary_variables={"b": loopy.TemporaryVariable("b", dtype=float, shape=(1, ),
                                                                        initializer=numpy.arange(1, dtype=float),
                                                                        read_only=True, address_space=loopy.AddressSpace.GLOBAL)},
                      target=loopy.CTarget())

print(loopy.generate_code_v2(k).device_code())
=>

static double (const b)[1] = { 0.0 };

void loopy_kernel(double *__restrict__ (a))
{
  a[0] = b[0];
}

Notice the parentheses around (const b) which is invalid.

@wence-

wence- commented Oct 2, 2019

Copy link
Copy Markdown

I think this was actually always a bug in loopy.

@inducer

inducer commented Oct 9, 2019

Copy link
Copy Markdown
Owner Author

Reverted in 2555326.

@inducer

inducer commented Oct 9, 2019

Copy link
Copy Markdown
Owner Author

Revival work ongoing in #25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants