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

[UR] Add adapter leak-checking tests #1029

Merged
merged 5 commits into from
Jan 11, 2024

Conversation

kswiecicki
Copy link
Contributor

No description provided.

Copy link
Contributor

@pbalcer pbalcer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test?

@kswiecicki
Copy link
Contributor Author

can you add a test?

Done.
Apparently there's a limit to the number of groups in a regex that ctest can compile (it fails as if the match failed) so I've changed (.*) to .* everywhere.

@pbalcer
Copy link
Contributor

pbalcer commented Nov 3, 2023

Done. Apparently there's a limit to the number of groups in a regex that ctest can compile (it fails as if the match failed) so I've changed (.*) to .* everywhere.

Use the python match scripts in the future.

@kswiecicki
Copy link
Contributor Author

kswiecicki commented Nov 3, 2023

Done. Apparently there's a limit to the number of groups in a regex that ctest can compile (it fails as if the match failed) so I've changed (.*) to .* everywhere.

Use the python match scripts in the future.

I've looked into the match.py but it seems to support only line-by-line matching. In my case I needed to match some unknown number of backtrace lines.

@kswiecicki
Copy link
Contributor Author

Done. Apparently there's a limit to the number of groups in a regex that ctest can compile (it fails as if the match failed) so I've changed (.*) to .* everywhere.

Use the python match scripts in the future.

I've added the {{IGNORE}} tag to match.py script and updated leak checking tests.

cmake/match.py Outdated Show resolved Hide resolved

if len(match_lines) != len(input_lines):
sys.exit(f"Line count doesn't match (is: {len(input_lines)}, expected: {len(match_lines)})")
def print_incorrect_match(match_line, present, expected):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brief?:P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

cmake/match.py Outdated
match_idx = 0
tags_in_effect = []
status = Status.PROCESSING
while status == Status.PROCESSING:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem necessary, this condition will never be false as far as I can tell. You can just do a while True: loop and check status at the end (and exit appropriately).

Copy link
Contributor Author

@kswiecicki kswiecicki Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the status variable inside the loop and changed the loop condition.
If I were to move the status check at the end, then I would need to check if either input or match file are empty to avoid index error. Logger has such test where both input and match files are empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the match case statement (switch equivalent) is not available in our current supported python version.


match_line = match_lines[match_idx]
if match_line.startswith(Tag.OPT.value):
tags_in_effect.append(Tag.OPT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't seem like there can be more than one active tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case below, there would be a point when ignore tag (active until the next match) is applied, then the optional tag (active until the next line) is applied next.

{{IGNORE}}
{{OPT}} optional line

@pbalcer
Copy link
Contributor

pbalcer commented Nov 20, 2023

I don't think we can merge this is as, it will lead to conflicts with the adapters branch. This patch needs to be rebased on adapters or wait until the branches are merged.

@kswiecicki
Copy link
Contributor Author

I don't think we can merge this is as, it will lead to conflicts with the adapters branch. This patch needs to be rebased on adapters or wait until the branches are merged.

Alright, I can wait for the adapters branch to be merged with main.

@codecov-commenter
Copy link

codecov-commenter commented Dec 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (42874bc) 15.73% compared to head (8c63208) 15.80%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1029      +/-   ##
==========================================
+ Coverage   15.73%   15.80%   +0.06%     
==========================================
  Files         223      223              
  Lines       31478    31481       +3     
  Branches     3558     3558              
==========================================
+ Hits         4954     4976      +22     
+ Misses      26473    26454      -19     
  Partials       51       51              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kswiecicki kswiecicki requested a review from a team as a code owner December 8, 2023 14:30
@kswiecicki kswiecicki force-pushed the val-refcount-adapter-fix branch 3 times, most recently from f63e9a3 to c5d95af Compare December 8, 2023 15:11
@pbalcer
Copy link
Contributor

pbalcer commented Dec 11, 2023

this does not appear to be changing anything but tests?

@kswiecicki kswiecicki changed the title [UR] Fix adapter refcount tracking [UR] Add adapter leak-checking tests Dec 11, 2023
@kswiecicki
Copy link
Contributor Author

this does not appear to be changing anything but tests?

The adapter refcount fix was merged on the adapters branch (#1150) and is now present on the main.
I've changed the title of this PR.

@kbenzie
Copy link
Contributor

kbenzie commented Dec 13, 2023

Sounds good @kswiecicki! I'm also working on resolving the issue I found in the test fixtures.

kbenzie added a commit to kbenzie/unified-runtime that referenced this pull request Dec 13, 2023
Since 5dc6e46 CTS tests which execute
kernels have been failing to create programs. This has been hidden due
to the match files containing expected failures in combination with an
bug in the match file script found while debugging oneapi-src#1029 check failures.

This patch adds `uur::KernelsEnvironment::CreateProgram()` which
automatically handles the differences between the HIP adapter and
others. On the hip path `urProgramCreateWithIL` is not longer called
because it is not supported by the adatper and
`urProgramCreateWithBinary` is used instead. The non-HIP path continues
to use `urProgramCreateWithIL`.
@kswiecicki kswiecicki force-pushed the val-refcount-adapter-fix branch 5 times, most recently from 1011a06 to b7f9af9 Compare December 20, 2023 14:21
@kswiecicki kswiecicki force-pushed the val-refcount-adapter-fix branch 2 times, most recently from 0a702ea to 237c23b Compare December 29, 2023 10:00
@pbalcer pbalcer added the ready to merge Added to PR's which are ready to merge label Jan 9, 2024
@kswiecicki kswiecicki force-pushed the val-refcount-adapter-fix branch 2 times, most recently from f6871e1 to 5551790 Compare January 9, 2024 15:32
@kswiecicki kswiecicki force-pushed the val-refcount-adapter-fix branch 2 times, most recently from 88ecbf0 to cc66c29 Compare January 10, 2024 16:12
When tests are aborted or failed at the assertion, the match script
receives "Aborted" or "Segmentation fault" as an input and compares it
with the match file. Previous match script allowed those tests to pass
despite not matching this input.
@kbenzie kbenzie merged commit e1414e1 into oneapi-src:main Jan 11, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Added to PR's which are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants