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

skip_stages doesn't respect debug_to_file, leading to runtime crashes. #8129

Closed
abadams opened this issue Feb 29, 2024 · 0 comments
Closed
Labels

Comments

@abadams
Copy link
Member

abadams commented Feb 29, 2024

The use of debug_to_file does not force a stage to be allocated, even though it was a use of the buffer, so you get a segfault at runtime when the debug_to_file implementation reads a bad pointer. Repro:

#include "Halide.h"
using namespace Halide;

int main() {
    Var x, y;
    Func f, g, h;

    Param<bool> p;
    f(x, y) = x + y;
    g(x, y) = f(x, y);
    h(x, y) = select(p, g(x, y), 0);

    f.compute_root().debug_to_file("/dev/null");
    g.compute_root();

    p.set(false);

    h.realize({1024, 1024});

    printf("Success!\n");

    return 0;
}

This is in fact already fixed by the new skip stages implementation in #8115, but I figured I'd open (and immediately close) the bug in case someone using Halide earlier than main is searching for it, to make them aware that it's fixed on main.

@abadams abadams added the bug label Feb 29, 2024
@abadams abadams closed this as completed Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant