Coverage for cuda / core / system / _inforom.pxi: 45.00%

20 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-22 01:37 +0000

1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4  

5  

6_INFOROM_OBJECT_MAPPING = { 

7 InforomObject.OEM: nvml.InforomObject.INFOROM_OEM, 

8 InforomObject.ECC: nvml.InforomObject.INFOROM_ECC, 

9 InforomObject.POWER: nvml.InforomObject.INFOROM_POWER, 

10 InforomObject.DEN: nvml.InforomObject.INFOROM_DEN, 

11} 

12  

13  

14cdef class InforomInfo: 

15 cdef Device _device 

16  

17 def __init__(self, device: Device): 

18 self._device = device 1a

19  

20 def get_version(self, inforom: InforomObject | str) -> str: 

21 """ 

22 Retrieves the InfoROM version for a given InfoROM object. 

23  

24 For all products with an InfoROM. 

25  

26 Fermi™ and higher parts have non-volatile on-board memory for persisting 

27 device info, such as aggregate ECC counts. 

28  

29 Parameters 

30 ---------- 

31 inforom: :class:`InforomObject` 

32 The InfoROM object to query. 

33  

34 Returns 

35 ------- 

36 str 

37 The InfoROM version. 

38 """ 

39 try: 1a

40 inforom_enum = _INFOROM_OBJECT_MAPPING[inforom] 1a

41 except KeyError: 

42 raise ValueError( 

43 f"Invalid InfoROM object: {inforom}. " 

44 f"Must be one of {list(InforomObject.__members__.values())}" 

45 ) from None 

46 return nvml.device_get_inforom_version(self._device._handle, inforom_enum) 1a

47  

48 @property 

49 def image_version(self) -> str: 

50 """ 

51 Retrieves the global InfoROM image version. 

52  

53 For all products with an InfoROM. 

54  

55 Image version just like VBIOS version uniquely describes the exact 

56 version of the InfoROM flashed on the board in contrast to InfoROM 

57 object version which is only an indicator of supported features. 

58  

59 Returns 

60 ------- 

61 str 

62 The InfoROM image version. 

63 """ 

64 return nvml.device_get_inforom_image_version(self._device._handle) 1a

65  

66 @property 

67 def configuration_checksum(self) -> int: 

68 """ 

69 Retrieves the checksum of the configuration stored in the device's InfoROM. 

70  

71 For all products with an InfoROM. 

72  

73 Can be used to make sure that two GPUs have the exact same 

74 configuration. Current checksum takes into account configuration stored 

75 in PWR and ECC InfoROM objects. Checksum can change between driver 

76 releases or when user changes configuration (e.g. disable/enable ECC) 

77  

78 Returns 

79 ------- 

80 int 

81 The InfoROM checksum. 

82 """ 

83 return nvml.device_get_inforom_configuration_checksum(self._device._handle) 1a

84  

85 def validate(self) -> None: 

86 """ 

87 Reads the InfoROM from the flash and verifies the checksums. 

88  

89 For all products with an InfoROM. 

90  

91 Raises 

92 ------ 

93 :class:`cuda.core.system.CorruptedInforomError` 

94 If the device's InfoROM is corrupted. 

95 """ 

96 nvml.device_validate_inforom(self._device._handle) 1a

97  

98 @property 

99 def bbx_flush_time(self) -> tuple[int, int]: 

100 """ 

101 Retrieves the timestamp and duration of the last flush of the BBX 

102 (blackbox) InfoROM object during the current run. 

103  

104 For all products with an InfoROM. 

105  

106 Returns 

107 ------- 

108 tuple[int, int] 

109 - timestamp: The start timestamp of the last BBX flush 

110 - duration_us: The duration (in μs) of the last BBX flush 

111 """ 

112 return nvml.device_get_last_bbx_flush_time(self._device._handle) 1a

113  

114 @property 

115 def board_part_number(self) -> str: 

116 """ 

117 The device board part number which is programmed into the board's InfoROM. 

118 """ 

119 return nvml.device_get_board_part_number(self._device._handle) 1a