-
Notifications
You must be signed in to change notification settings - Fork 795
[SYCL][NATIVECPU] Enable source-based code coverage in Native CPU #15073
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4147842
[SYCLNATIVECPU] initial support for code coverage
uwedolinsky e72e647
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky ef55ccb
[SYCLNATIVECPU] fixed comments
uwedolinsky 2755480
[SYCLNATIVECPU] fixed comments
uwedolinsky f28c4fb
[SYCLNATIVECPU] removed check for clang-rt
uwedolinsky b02ef1e
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky 4e6664d
[SYCLNATIVECPU] clang-format
uwedolinsky 593a981
[SYCLNATIVECPU] file mode change
uwedolinsky 149a352
[SYCLNATIVECPU] source location change for coverage
uwedolinsky f56c4d4
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky 896ca81
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky 0ec7691
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky 55d31e7
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky b90ea9b
[SYCL] Attach SourceLocation to kernel body to enable coverage gen
uwedolinsky 094e10a
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky f14c4f2
[SYCLNATIVECPU] put back NL to reduce noise
uwedolinsky 7acb09f
[SYCLNATIVECPU] moved conditional
uwedolinsky da794ff
[SYCLNATIVECPU] restored original file mode
uwedolinsky d6dff0e
[SYCLNATIVECPU] fixed documentation
uwedolinsky 637caec
[SYCLNATIVECPU] fixed documentation
uwedolinsky cb35294
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky 6b72582
[SYCLNATIVECPU] revert change
uwedolinsky ad356fb
Update clang/lib/Driver/ToolChains/SYCL.cpp
uwedolinsky ea90f2f
Update clang/lib/Driver/ToolChains/SYCL.cpp
uwedolinsky c25bad1
[SYCLNATIVECPU] Pascal Casing var
uwedolinsky 82e4f64
[SYCLNATIVECPU] removed local variable
uwedolinsky a0d2d55
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky 49fa00f
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky a20329c
[SYCL] new test checking valid kernel source location
uwedolinsky e8f776c
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky d3558b7
Merge remote-tracking branch 'origin/sycl' into uwe/syclcoverage
uwedolinsky ae41bfa
[SYCLNATIVECPU] clang-format
uwedolinsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %clang_cc1 -fsycl-is-device -ast-dump %s | FileCheck %s | ||
// | ||
// Checks that the compound statement of the implicitly generated kernel body | ||
// has a valid source location (containing "line"). Previously this location | ||
// was invalid containing "<<invalid sloc>>" which causes asserts in the | ||
// llvm profiling tools. | ||
|
||
#include "Inputs/sycl.hpp" | ||
|
||
struct Functor { | ||
void operator()() const {} | ||
}; | ||
|
||
// CHECK: FunctionDecl {{.*}} _ZTS7Functor 'void ()' | ||
// CHECK-NEXT: |-CompoundStmt {{.*}} <{{.*}}line{{.*}}> | ||
|
||
int main() { | ||
|
||
sycl::queue().submit([&](sycl::handler &cgh) { | ||
cgh.single_task(Functor{}); | ||
}); | ||
} |
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
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
Oops, something went wrong.
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.
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.
What is this actually doing? This is supposed to correspond to location in source code IIUC which of course doesn't exist for compiler generated code. So what location is being picked up here?
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.
This is picking up the source location from the kernel body - so the compound statement uses the same location as the kernel body. You are right, this is a compiler-generated function, but it still needs a valid source location to ensure any tools processing the clang AST and requiring that source location to be valid to succeed. Other compiler-generated function like constructors also have valid locations even though they don't exist in source code.
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.
I think this sounds reasonable but I would like @tahonermann to also weigh in here. IIRC the work we re currently implementing for upstream clang (which will replace a lot of this code eventually) does not set SourceLocations as well.
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.
@elizabethandrews @tahonermann do you have updates on this? Thank you
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.
Sorry, I somehow missed @elizabethandrews's earlier request for me to weigh in on this.
I think this is reasonable. I'm not sure there is clear guidance for cases like this where a function definition is composed from both generated and written code.
There might be cases in the new upstream implementation that will need to have source locations added. I think I generally opted for generated code to have builtin/unknown source locations.
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.
@tahonermann I was trying to set the location similar to what clang does with implicitly generated constructors which also get a valid source location (the location of the struct name). The main aim of this PR is just to avoid asserts on invalid source locations in the clang AST when generating profiling/coverage code (Tested by the new invocation added to sycl/test/native_cpu/vector-add.cpp.