Merged
Conversation
This means we actually print error messages when using exceptions and the makefile
GPU loop constraints were checked in two different places. Checking them
in ScheduleFunctions was incorrect because it didn't consider update
definitions and specializations. Checking them in FuseGPUThreadLoops was
too late, because the Var names have gone (they've been renamed to
things like __thread_id_x). Furthermore, some problems were internal
errors or runtime errors when they should have been user errors. We
allowed 4d thread and block dimensions, but then hit an internal error.
This PR centralizes checking of GPU loop structure in
CanonicalizeGPUVars and adds more helpful error messages that print the
problematic loop structure. E.g:
```
Error: GPU thread loop over f$8.s0.v0 is inside three other GPU thread
loops. The maximum number of nested GPU thread loops is 3. The loop nest
is:
compute_at for g$8:
for g$8.s0.v7:
for g$8.s0.v6:
for g$8.s0.v5:
for g$8.s0.v4:
gpu_block g$8.s0.v3:
gpu_block g$8.s0.v2:
gpu_thread g$8.s0.v1:
gpu_thread g$8.s0.v0:
store_at for f$8:
compute_at for f$8:
gpu_thread f$8.s0.v1:
gpu_thread f$8.s0.v0:
```
Fixes the bug found in #7946
steven-johnson
approved these changes
Feb 5, 2024
|
|
||
| std::ostringstream err; | ||
|
|
||
| /* |
Contributor
There was a problem hiding this comment.
If this is meant to left here in commented-out form, it is essential you add a comment explaining why. (Otherwise, just delete it.)
…alide/Halide into abadams/validate_gpu_schedules
Contributor
|
ready to land? |
ardier
pushed a commit
to ardier/Halide-mutation
that referenced
this pull request
Mar 3, 2024
* Update makefile to use test/common/terminate_handler.cpp
This means we actually print error messages when using exceptions and
the makefile
* Better validate of GPU schedules
GPU loop constraints were checked in two different places. Checking them
in ScheduleFunctions was incorrect because it didn't consider update
definitions and specializations. Checking them in FuseGPUThreadLoops was
too late, because the Var names have gone (they've been renamed to
things like __thread_id_x). Furthermore, some problems were internal
errors or runtime errors when they should have been user errors. We
allowed 4d thread and block dimensions, but then hit an internal error.
This PR centralizes checking of GPU loop structure in
CanonicalizeGPUVars and adds more helpful error messages that print the
problematic loop structure. E.g:
```
Error: GPU thread loop over f$8.s0.v0 is inside three other GPU thread
loops. The maximum number of nested GPU thread loops is 3. The loop nest
is:
compute_at for g$8:
for g$8.s0.v7:
for g$8.s0.v6:
for g$8.s0.v5:
for g$8.s0.v4:
gpu_block g$8.s0.v3:
gpu_block g$8.s0.v2:
gpu_thread g$8.s0.v1:
gpu_thread g$8.s0.v0:
store_at for f$8:
compute_at for f$8:
gpu_thread f$8.s0.v1:
gpu_thread f$8.s0.v0:
```
Fixes the bug found in halide#7946
* Delete dead code
* Actually clear the ostringstream
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GPU loop constraints were checked in two different places. Checking them
in ScheduleFunctions was incorrect because it didn't consider update
definitions and specializations. Checking them in FuseGPUThreadLoops was
too late, because the Var names have gone (they've been renamed to
things like __thread_id_x). Furthermore, some problems were internal
errors or runtime errors when they should have been user errors. We
allowed 4d thread and block dimensions, but then hit an internal error.
This PR centralizes checking of GPU loop structure in
CanonicalizeGPUVars and adds more helpful error messages that print the
problematic loop structure. E.g:
Fixes the bug found in #7946