Skip to content

Conversation

steven-johnson
Copy link
Contributor

If you try to build and run something with openglcompute and debug, you may crash with a div-by-zero, because the openglcompute runtime never calls halide_start_clock(), and all implementations of halide_current_time_ns() assume that it has been called. On (e.g.) OSX, this results in div by zero. This fixes it by inserting the correct call into openglruntime.cpp, and also adding debug-only asserts to all the halide_current_time_ns() implementations.

(I was tempted to fix this by removing halide_start_clock() entirely and just lazily initing the initial value in halide_current_time_ns(), but I figured that would likely get pushback...)

If you try to build and run something with `openglcompute` and `debug`, you may crash with a div-by-zero, because the openglcompute runtime never calls `halide_start_clock()`, and all implementations of `halide_current_time_ns()` assume that it has been called. On (e.g.) OSX, this results in div by zero. This fixes it by inserting the correct call into openglruntime.cpp, and also adding debug-only asserts to all the `halide_current_time_ns()` implementations.

(I was tempted to fix this by removing `halide_start_clock()` entirely and just lazily initing the initial value in `halide_current_time_ns()`, but I figured that would likely get pushback...)
@steven-johnson steven-johnson merged commit d3ea755 into master Nov 9, 2021
@steven-johnson steven-johnson deleted the srj/start-oglc branch November 9, 2021 17:03
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