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

Add exception manager to handle options which aren't covered in all CTK versions #371

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ksimpson-work
Copy link
Contributor

This change skips tests when a specific nvjitlink exception is raised for invalid option, which happens if the option is invalid, or if the option is invalid for the given CTK.

I think we should also add cuda 12.4 to the test matrix because <21.3 targets the culink backend, and cuda 12.6 has options which aren't part of 12.4

Copy link
Contributor

copy-pr-bot bot commented Jan 10, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ksimpson-work ksimpson-work self-assigned this Jan 10, 2025
@ksimpson-work ksimpson-work added P1 Medium priority - Should do cuda.core Everything related to the cuda.core module labels Jan 10, 2025
@ksimpson-work ksimpson-work requested a review from leofang January 10, 2025 00:16
@ksimpson-work
Copy link
Contributor Author

/ok to test

@ksimpson-work ksimpson-work mentioned this pull request Jan 10, 2025
@leofang leofang added the enhancement Any code-related improvements label Jan 12, 2025
@ksimpson-work
Copy link
Contributor Author

/ok to test

Comment on lines +49 to +50
if culink_backend:
return
Copy link
Member

Choose a reason for hiding this comment

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

I actually don't know the behavior of return in a function decorated by contextmanager. I don't think the semantics is documented? Perhaps this is what you are after?

if not culink_backend:
    skip_version_specific_linker_options = ...  # this decorated function, but without the return
else:
    skip_version_specific_linker_options = nullcontext

https://docs.python.org/3/library/contextlib.html#contextlib.nullcontext

Comment on lines +53 to +55
except nvjitlink.nvJitLinkError as e:
if e.status == nvjitlink.Result.ERROR_UNRECOGNIZED_OPTION:
pytest.skip("current nvjitlink version does not support the option provided")
Copy link
Member

Choose a reason for hiding this comment

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

  1. this probably needs a reraise when the error code is not unrecognized option:
Suggested change
except nvjitlink.nvJitLinkError as e:
if e.status == nvjitlink.Result.ERROR_UNRECOGNIZED_OPTION:
pytest.skip("current nvjitlink version does not support the option provided")
except nvjitlink.nvJitLinkError as e:
if e.status == nvjitlink.Result.ERROR_UNRECOGNIZED_OPTION:
pytest.skip("current nvjitlink version does not support the option provided")
else:
raise
  1. I am wondering if this check should be moved to _exception_manager() in _linker.py? WDYT?

Comment on lines +56 to +57
except Exception as e:
raise e
Copy link
Member

Choose a reason for hiding this comment

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

this can be removed entirely

Suggested change
except Exception as e:
raise e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda.core Everything related to the cuda.core module enhancement Any code-related improvements P1 Medium priority - Should do
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants