Skip to content

Commit 1d9ff05

Browse files
authored
fix(cuda.core): decode signed long long field values (#2727)
Signed-off-by: Rui Luo <ruluo@nvidia.com>
1 parent a1c784b commit 1d9ff05

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎cuda_core/cuda/core/system/_field_values.pxi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ cdef class FieldValue:
7575
elif value_type == ValueType.UNSIGNED_LONG_LONG:
7676
return int(value.ull_val[0])
7777
elif value_type == ValueType.SIGNED_LONG_LONG:
78-
return int(value.ll_val[0])
78+
return int(value.sll_val[0])
7979
elif value_type == ValueType.SIGNED_INT:
8080
return int(value.si_val[0])
8181
elif value_type == ValueType.UNSIGNED_SHORT:

‎cuda_core/tests/system/test_system_device.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,19 @@ def test_field_values(subtests):
445445
assert field_values[0].value <= old_value
446446

447447

448+
@pytest.mark.agent_authored(model="gpt-5.6-sol")
449+
def test_field_value_decodes_signed_long_long():
450+
"""SIGNED_LONG_LONG decodes from nvmlValue_t.sll_val as a Python int."""
451+
field_value = nvml.FieldValue()
452+
field_value.nvml_return = int(nvml.Return.SUCCESS)
453+
field_value.value_type = int(nvml.ValueType.SIGNED_LONG_LONG)
454+
field_value.value.sll_val[0] = -45
455+
456+
value = _device.FieldValue(field_value).value
457+
assert value == -45
458+
assert type(value) is int
459+
460+
448461
@pytest.mark.skipif(helpers.IS_WSL or helpers.IS_WINDOWS, reason="Device attributes not supported on WSL or Windows")
449462
def test_get_all_devices_with_cpu_affinity(subtests):
450463
for i in range(multiprocessing.cpu_count()):

0 commit comments

Comments
 (0)