Repository navigation
Conversation
Seed the field status with an invalid sentinel so a successful native no-op cannot accidentally pass on recycled memory. Xfail when Orin leaves the sentinel unchanged, preserving normal checks on fixed drivers and other devices. Label the workaround explicitly in the source comment and xfail reason.
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
📝 Summary
Priority: ⬇️ Low Change: Bug fix Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
85c60964-6f71-40be-90e0-cf913a2bf0c1
📒 Files selected for processing: 1
cuda_bindings/tests/nvml/test_nvlink.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
| fields[0].nvml_return = -1 | ||
| value = nvml.device_get_field_values(device, fields)[0] | ||
| if value.nvml_return == -1 and "Orin" in nvml.device_get_name(device): | ||
| pytest.xfail( |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
set -eu
printf '%s\n' '--- reviewed head test ---'
git show 412659b856b8c1d7086bdef9351f66e3b4cecabd:cuda_bindings/tests/nvml/test_nvlink.py | nl -ba | sed -n '1,90p'
printf '%s\n' '--- base test ---'
git show 576ef68874f2fcbbb00f7f2302960c3b20597164:cuda_bindings/tests/nvml/test_nvlink.py | nl -ba | sed -n '1,90p'
printf '%s\n' '--- diff ---'
git diff --unified=30 576ef68874f2fcbbb00f7f2302960c3b20597164 412659b856b8c1d7086bdef9351f66e3b4cecabd -- cuda_bindings/tests/nvml/test_nvlink.pyRepository: NVIDIA/cuda-python
Length of output: 5440
important: Defer the Orin xfail only after bypassing its sentinel assertion.
When the Orin sentinel remains, moving pytest.xfail() after the loop still reaches the first return-code assertion, which rejects -1 before the alternate query and later devices run. Record the Orin condition, skip only that assertion, keep the alternate query active, and call pytest.xfail() after the loop.
Suggested fix
def test_nvlink_get_link_count(all_devices):
"""
Checks that the link count of the device is same.
"""
+ orin_nvml_bug = False
for device in all_devices:
...
value = nvml.device_get_field_values(device, fields)[0]
if value.nvml_return == -1 and "Orin" in nvml.device_get_name(device):
- pytest.xfail(
- "Orin NVML nvbug 6952048: nvmlDeviceGetFieldValues returns success without populating the result"
- )
- assert value.nvml_return == nvml.Return.SUCCESS or value.nvml_return == nvml.Return.ERROR_NOT_SUPPORTED, (
- f"Unexpected return {value.nvml_return} for link count field query"
- )
+ orin_nvml_bug = True
+ else:
+ assert value.nvml_return == nvml.Return.SUCCESS or value.nvml_return == nvml.Return.ERROR_NOT_SUPPORTED, (
+ f"Unexpected return {value.nvml_return} for link count field query"
+ )
...
assert value.nvml_return == nvml.Return.SUCCESS or value.nvml_return == nvml.Return.ERROR_NOT_SUPPORTED, (
f"Unexpected return {value.nvml_return} for link count field query"
)
+
+ if orin_nvml_bug:
+ pytest.xfail(
+ "Orin NVML nvbug 6952048: nvmlDeviceGetFieldValues returns success without populating the result"
+ )
|
mdboom
left a comment
There was a problem hiding this comment.
I don't think we should just workaround this in a test. Seems like a bug that we should protect our users from. That is, we should set an error code inside of the device_get_field_values function and populate the error back out.
Description
Seed the field status with an invalid sentinel so a successful native no-op cannot accidentally pass on recycled memory. Xfail when Orin leaves the sentinel unchanged, preserving normal checks on fixed drivers and other devices.
Label the workaround explicitly in the source comment and xfail reason.
Interactive testing on Jetson Orin:
xrefs: