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

Fix OGLC debug builds #6399

Merged
merged 1 commit into from
Nov 9, 2021
Merged

Fix OGLC debug builds #6399

merged 1 commit into from
Nov 9, 2021

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