Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate intermediate names generated that cause simpiler to fail #7906

Closed
TH3CHARLie opened this issue Oct 19, 2023 · 0 comments · Fixed by #7908
Closed

duplicate intermediate names generated that cause simpiler to fail #7906

TH3CHARLie opened this issue Oct 19, 2023 · 0 comments · Fixed by #7908
Assignees
Labels

Comments

@TH3CHARLie
Copy link
Contributor

A repro that fails on current main:

#include "Halide.h"
using namespace Halide;

int main() {
    Buffer<int> buf1, buf2;
    Func input("input");
    Func local_sum("local_sum");
    Func blurry("blurry");
    Var x("x"), y("y");
    input(x, y) = 2 * x + 5 * y;
    RDom r(-2, 5, -2, 5);
    local_sum(x, y) = 0;
    local_sum(x, y) += input(x + r.x, y + r.y);
    blurry(x, y) = cast<int32_t>(local_sum(x, y) / 25);
    {
        Pipeline p({blurry});
        std::map<std::string, Parameter> params;
        serialize_pipeline(p, "test.hlpipe", params);
        auto dp = deserialize_pipeline("test.hlpipe", params);
        buf1 = p.realize({128, 128});
    }
    {
        Var yo, yi, x_yo_f;
        input.vectorize(y).split(y, yo, yi, 2, TailStrategy::ShiftInwards).unroll(x).fuse(x, yo, x_yo_f);
        blurry.compute_root();
        input.compute_at(blurry, x);
        Pipeline p({blurry});
        buf2 = p.realize({128, 128});
    }
    return 0;
}

error:

Internal Error at /home/xuanda/dev/Serializer/Halide-clean/src/Simplify_Let.cpp:68 triggered by user code at : Condition failed: !var_info.contains(op->name): Simplify only works on code where every name is unique. Repeated name: input.s0.y.v3.base
[1]    387235 abort (core dumped)  
@TH3CHARLie TH3CHARLie added the bug label Oct 19, 2023
abadams added a commit that referenced this issue Oct 19, 2023
In the following code:

let a = b in
  X
let a = c in
  Y

If Stmt X successfully had stores interleaved, it was re-nesting it like
so:

let a = b in
  X
  let a = c in
    Y

This introduces a shadowed variable 'a', which is illegal at this stage
of lowering.

Fixes #7906

Also some drive-by fixes to earlier tests that had debugging code left
in.
@abadams abadams self-assigned this Oct 19, 2023
abadams added a commit that referenced this issue Oct 20, 2023
In the following code:

let a = b in
  X
let a = c in
  Y

If Stmt X successfully had stores interleaved, it was re-nesting it like
so:

let a = b in
  X
  let a = c in
    Y

This introduces a shadowed variable 'a', which is illegal at this stage
of lowering.

Fixes #7906

Also some drive-by fixes to earlier tests that had debugging code left
in.
ardier pushed a commit to ardier/Halide-mutation that referenced this issue Mar 3, 2024
In the following code:

let a = b in
  X
let a = c in
  Y

If Stmt X successfully had stores interleaved, it was re-nesting it like
so:

let a = b in
  X
  let a = c in
    Y

This introduces a shadowed variable 'a', which is illegal at this stage
of lowering.

Fixes halide#7906

Also some drive-by fixes to earlier tests that had debugging code left
in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants