Skip to content

[SYCL] Detect ze call leaking in E2E tests #19710

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

Open
wants to merge 2 commits into
base: sycl
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sycl/test-e2e/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,22 @@ def map_result(features, code):
code = lit.Test.XFAIL
return code

def check_leak(output):
keyword_found = False
for line in output.splitlines():
if keyword_found and "LEAK" in line:
Copy link
Contributor

@cperkinsintel cperkinsintel Aug 5, 2025

Choose a reason for hiding this comment

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

Just FYI, we already have a lit var %{l0_leak_check} which a bunch of the tests still use (instead of UR_L0_LEAKS_DEBUG ). It gets replaced by the env var in the final invocation, but I'm not sure if this python script here will detect.

I think that l0_leak_check directive is no longer needed and probably could be replaced by the actual env var. It's in hundreds of tests right now.

Copy link
Member

Choose a reason for hiding this comment

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

I think the tests that set the env var (either directly or by using %{l0_leak_check}) already check for absence of "LEAK" (--implicit-check-not=LEAK) so we don't have to check it again here. As far as I understand this is only needed when the user decides to run all the tests with leak checking (e.g. passing --param ur_l0_leaks_debug=1 to lit).

return lit.Test.FAIL
if "Check balance of create/destroy calls" in line:
keyword_found = True
return lit.Test.PASS

if len(triples) == 1 and test.config.test_mode == "build-only":
result.code = map_result(test.config.available_features, result.code)
if len(devices_for_test) == 1:
device = devices_for_test[0]
result.code = map_result(test.config.sycl_dev_features[device], result.code)
if litConfig.params.get("ur_l0_leaks_debug") and result.code is lit.Test.PASS:
result.code = check_leak(result.output)

# Set this to empty so internal lit code won't change our result if it incorrectly
# thinks the test should XFAIL. This can happen when our XFAIL condition relies on
Expand Down
Loading