-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add filtering capabilities to HL_DEBUG_CODEGEN #8627
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
Conversation
I like the approach! I have two questions: Why you chose for suffixes on filename and function name, instead of prefix, or just "contains" the test string. For file paths, I'm guessing prefix is impractical because you'd have the full path of the file (as opposed to the name). Same goes for "contains", as you might accidentally match the whole source tree if you have a parent path somewhere that contains the target string. But, for function names, I don't see a good reason why it should be a suffix match. Another question I have is, can you specify a function name without specifying a file name?
AFAIK paths can't contain commas nor colons. First @ signals begin of function part of the rule. Like this, line numbers are close to the filename, as is more common. I think it supports the same functionality, but now we can be lazy, and immediately go to the function part of it:
for maximal laziness (and potentially an even wider match across the project). |
Contains might be better, but suffix was quick to implement because of
That's a nicer syntax, I agree. I'll update the PR. 🙂 |
verbosity[,filename[:line_low[-line_high]]][@func] Co-authored-by: Martijn Courteaux <[email protected]>
Seems that c805e54 is biting you on MSVC. |
That build failure is thanks to a missing |
I'm realizing that |
I am in favor of not having |
With the voidifier trick, I managed to remove the debug class entirely. Now it's just a free function and a macro that conditionally evaluates to |
There are still two "client" uses of The only other use is in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally this looks awesome, but see my comment about debug
leaking into non-Halide code and issues thereof
@abadams -- how should we pipe |
This is ready for review. |
Super useful! Thanks for this. I'm using it two days straight now, and it's very very handy! 😄 |
This PR extends the
HL_DEBUG_CODEGEN
semantics with features for filtering messages only from certain files, functions, and lines. I'm opening this as a draft to invite discussion.The current syntax for
HL_DEBUG_CODEGEN
is a single number setting the verbosity level globally for alldebug(N)
streams.The proposed syntax for
HL_DEBUG_CODEGEN
is a;
-delimited list of rules of the form:verbosity
is a positive integer indicating the maximum (inclusive) verbosity level to emit. This is equivalent to the current semanticsfile_suffix
is a maximal string of non-:@
characters. If it is specified, the rule applies only to files ending in this string. Typically, this will be a path fragment likesrc/Func.cpp
.line_low
andline_high
specify a range of line numbers, inclusive on both sides. If neither is specified, they are0
andINT_MAX
. If onlyline_low
is specified,line_high
is set equal toline_low
.function_suffix
is a string. If it is specified, the rule applies only to functions (as determined by__FUNCTION__
) whose names end in this string. Typically, this will be the whole name of a function (e.g.rfactor
)The motivation for this is to enable higher-signal print debugging. For example, a useful setting for me while debugging
rfactor
might be:1;5,Func.cpp@rfactor;5,Associativity.cpp