Giter Club home page Giter Club logo

Comments (8)

jrk avatar jrk commented on May 18, 2024

I'm helping set up the Python bindings for trial use in Fredo's class. Promoting user input errors to some catchable mechanism would make the user experience in Python, in particular, much better (it could show at least a Python stack trace, and would not instantly exit(1) the REPL when coding interactively).

from halide.

zvookin avatar zvookin commented on May 18, 2024

By user input errors do you mean parameters that are bad or code that
cannot be compiled? The former should be catchable via overriding
halide_error to catch the error messages. If it is called, that means an
error occured. Making all this happen in a thread safe manner is ugly, but
doable.

I'm guessing I'm missing something...

On Wed, Nov 13, 2013 at 3:08 PM, Jonathan Ragan-Kelley <
[email protected]> wrote:

I'm helping set up the Python bindings for trial use in Fredo's class.
Promoting user input errors to some catchable mechanism would make the user
experience in Python, in particular, much better (it could show at least a
Python stack trace, and would not instantly exit(1) the REPL when coding
interactively).


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-28443579
.

from halide.

jrk avatar jrk commented on May 18, 2024

This is a reference to our past private thread on “Halide error reporting.”

I mean user input errors at the compiler API level (constructing IR or schedules that don’t make sense, or otherwise incorrectly using the interfaces). We throw asserts with error strings not just for “oh my god, the compiler is going to blow up” invariants we maintain internally, but also for bad inputs created by user code. It would be useful if these user-gave-us-something-bad errors followed a different path from our-code-confused-itself-internally asserts, in part so that the errors can be caught rather than exiting the host program.

from halide.

jrk avatar jrk commented on May 18, 2024

I’m glad to take an initial crack at it, if people buy that a trivial design is a worthwhile change. I’m just replacing existing asserts which relate mostly to user input with some alternate function like:

inline void Halide::Internal::user_assert(bool condition, string message)

This function could:

  1. print and exit(1) (existing assert behavior)
  2. raise an exception
  3. do something else

I’m assuming (1) by default for now, with either #ifdefs or runtime flags to change to (2).

Is this worthwhile, or would people rather continue waiting for a full rethink of the compiler error handling stack as discussed off-list in July?

from halide.

abadams avatar abadams commented on May 18, 2024

I buy that the trivial design is a worthwhile change.

On Wed, Nov 13, 2013 at 3:34 PM, Jonathan Ragan-Kelley <
[email protected]> wrote:

I’m glad to take an initial crack at it, if people buy that a trivial
design is a worthwhile change. I’m just replacing existing asserts which
relate mostly to user input with some alternate function like:

inline void Halide::Internal::user_assert(bool condition, string message)

This function could:

  1. print and exit(1) (existing assert behavior)
  2. raise an exception
  3. do something else

I’m assuming (1) by default for now, with either #ifdefs or runtime flags
to change to (2).

Is this worthwhile, or would people rather continue waiting for a full
rethink of the compiler error handling stack as discussed off-list in July?


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-28445379
.

from halide.

abadams avatar abadams commented on May 18, 2024

A prototype of a more extensive rework of error conditions is in the introspection branch. It does a superset of the above.

from halide.

abadams avatar abadams commented on May 18, 2024

merged into trunk in 525176e

from halide.

jrk avatar jrk commented on May 18, 2024

Much like.

from halide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.