-
Notifications
You must be signed in to change notification settings - Fork 334
test: handle partial NVML support on Jetson Orin #2947
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
14 commits
Select commit
Hold shift + click to select a range
cc51b13
test: fix Orin coverage with CUDA 13.4
rwgk b8924e6
Merge branch 'main' into orin_fixes
rwgk bcbf823
test: preserve partial NVML coverage on Orin
rwgk 139fc14
Merge branch 'main' into orin_fixes
rwgk f2b7822
test: address Orin review feedback
rwgk c390f89
Merge branch 'main' into orin_fixes
rwgk 91daeaa
fix(cuda.core): handle partial NVML support on Orin
rwgk 2ed2554
test(cuda.core): verify unsupported NVML caller behavior
rwgk c128ca7
Merge branch 'main' into orin_fixes
rwgk 7554cd7
test(cuda.core): restore skips for unsupported NVML APIs
rwgk 4ed9dd0
fix(cuda.core): remove NVLink state preflight
rwgk 497203c
test(cuda.core): share VMM leak test allocation size
rwgk 66bf6bb
Merge main into orin_fixes
rwgk e2ae412
Merge main into rwgk/orin-ctk-13-4-tests
rwgk 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
Some comments aren't visible on the classic Files Changed page.
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
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,49 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import pytest | ||
|
|
||
| from cuda.bindings import nvml | ||
| from cuda.core import system | ||
|
|
||
|
|
||
| def _nvlink_count_field(count, status): | ||
| field = nvml.FieldValue() | ||
| field.field_id = int(nvml.FieldId.DEV_NVLINK_LINK_COUNT) | ||
| field.nvml_return = int(status) | ||
| field.value_type = int(nvml.ValueType.UNSIGNED_INT) | ||
| field.value.ui_val[0] = count | ||
| return field | ||
|
|
||
|
|
||
| @pytest.mark.thread_unsafe(reason="Temporarily replaces process-global NVML functions") | ||
| @pytest.mark.agent_authored(model="gpt-6") | ||
| def test_nvlink_zero_count_does_not_require_link_state(monkeypatch): | ||
| def unsupported_state(_handle, _link): | ||
| raise nvml.NotSupportedError(nvml.Return.ERROR_NOT_SUPPORTED) | ||
|
|
||
| field = _nvlink_count_field(0, nvml.Return.SUCCESS) | ||
| monkeypatch.setattr(nvml, "device_get_nvlink_state", unsupported_state) | ||
| monkeypatch.setattr(nvml, "device_get_field_values", lambda _handle, _fields: field) | ||
| device = system.Device.__new__(system.Device) | ||
|
|
||
| assert device.get_nvlink_count() == 0 | ||
| assert list(device.get_nvlinks()) == [] | ||
|
|
||
|
|
||
| @pytest.mark.thread_unsafe(reason="Temporarily replaces process-global NVML functions") | ||
| @pytest.mark.parametrize("method", ["get_nvlink_count", "get_nvlinks"]) | ||
| @pytest.mark.parametrize( | ||
| ("status_name", "exception_name"), | ||
| [("ERROR_NOT_SUPPORTED", "NotSupportedError"), ("ERROR_UNKNOWN", "UnknownError")], | ||
| ) | ||
| @pytest.mark.agent_authored(model="gpt-6") | ||
| def test_nvlink_queries_propagate_field_error(monkeypatch, method, status_name, exception_name): | ||
| field = _nvlink_count_field(0, getattr(nvml.Return, status_name)) | ||
| monkeypatch.setattr(nvml, "device_get_field_values", lambda _handle, _fields: field) | ||
| device = system.Device.__new__(system.Device) | ||
|
|
||
| with pytest.raises(getattr(system, exception_name)): | ||
| result = getattr(device, method)() | ||
| if method == "get_nvlinks": | ||
| list(result) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.