152152 "nvmlDeviceGetNvLinkRemotePciInfo_v2" ,
153153]
154154
155+ NVML_MANUAL_FUNCTIONS = {
156+ "nvmlDeviceGetTotalEccErrors" ,
157+ "nvmlDeviceGetDetailedEccErrors" ,
158+ "nvmlDeviceGetMemoryErrorCounter" ,
159+ }
160+
155161NVML_CODEGEN_FUNCTIONS = []
156162
157163
@@ -764,72 +770,6 @@ def nvml_device_three_args_value(
764770 )
765771
766772
767- def nvml_server_device_two_args_stub (first_type , second_type , out_type , value_init ):
768- return f"""nvmlDevice_t _lupine_device = nullptr;
769- { first_type } _lupine_first = {{}};
770- { second_type } _lupine_second = {{}};
771- if (rpc_read(conn, &_lupine_device, sizeof(_lupine_device)) < 0 ||
772- rpc_read(conn, &_lupine_first, sizeof(_lupine_first)) < 0 ||
773- rpc_read(conn, &_lupine_second, sizeof(_lupine_second)) < 0) {{
774- return -1;
775- }}
776- int _lupine_request_id = rpc_read_end(conn);
777- if (_lupine_request_id < 0) {{
778- return -1;
779- }}
780-
781- { out_type } _lupine_value = { value_init } ;
782- nvmlReturn_t _lupine_result = NVML_SUCCESS;
783- if (rpc_write_start_response(conn, _lupine_request_id) < 0 ||
784- rpc_write(conn, &_lupine_value, sizeof(_lupine_value)) < 0 ||
785- rpc_write(conn, &_lupine_result, sizeof(_lupine_result)) < 0 ||
786- rpc_write_end(conn) < 0) {{
787- return -1;
788- }}
789- return 0;"""
790-
791-
792- def nvml_server_device_three_args_stub (
793- first_type , second_type , third_type , out_type , value_init
794- ):
795- return f"""nvmlDevice_t _lupine_device = nullptr;
796- { first_type } _lupine_first = {{}};
797- { second_type } _lupine_second = {{}};
798- { third_type } _lupine_third = {{}};
799- if (rpc_read(conn, &_lupine_device, sizeof(_lupine_device)) < 0 ||
800- rpc_read(conn, &_lupine_first, sizeof(_lupine_first)) < 0 ||
801- rpc_read(conn, &_lupine_second, sizeof(_lupine_second)) < 0 ||
802- rpc_read(conn, &_lupine_third, sizeof(_lupine_third)) < 0) {{
803- return -1;
804- }}
805- int _lupine_request_id = rpc_read_end(conn);
806- if (_lupine_request_id < 0) {{
807- return -1;
808- }}
809-
810- { out_type } _lupine_value = { value_init } ;
811- nvmlReturn_t _lupine_result = NVML_SUCCESS;
812- if (rpc_write_start_response(conn, _lupine_request_id) < 0 ||
813- rpc_write(conn, &_lupine_value, sizeof(_lupine_value)) < 0 ||
814- rpc_write(conn, &_lupine_result, sizeof(_lupine_result)) < 0 ||
815- rpc_write_end(conn) < 0) {{
816- return -1;
817- }}
818- return 0;"""
819-
820-
821- def nvml_ecc_counter_stub (name , params , value_name , value_init , server_body ):
822- nvml_codegen_function (
823- name ,
824- params ,
825- f"""if ({ value_name } != nullptr) {{
826- *{ value_name } = { value_init } ;
827- }}
828- return NVML_SUCCESS;""" ,
829- server_body ,
830- )
831-
832-
833773def nvml_device_two_values (name , first_type , first_name , second_type , second_name ):
834774 nvml_codegen_function (
835775 name ,
@@ -915,39 +855,34 @@ def nvml_device_two_values(name, first_type, first_name, second_type, second_nam
915855 "nvmlPciInfo_t" ,
916856 "pci" ,
917857)
918- nvml_ecc_counter_stub (
858+ nvml_device_two_args_value (
919859 "nvmlDeviceGetTotalEccErrors" ,
920- "nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long *eccCounts" ,
860+ "nvmlMemoryErrorType_t" ,
861+ "errorType" ,
862+ "nvmlEccCounterType_t" ,
863+ "counterType" ,
864+ "unsigned long long" ,
921865 "eccCounts" ,
922- "0" ,
923- nvml_server_device_two_args_stub (
924- "nvmlMemoryErrorType_t" , "nvmlEccCounterType_t" , "unsigned long long" , "0"
925- ),
926866)
927- nvml_ecc_counter_stub (
867+ nvml_device_two_args_value (
928868 "nvmlDeviceGetDetailedEccErrors" ,
929- "nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlEccErrorCounts_t *eccCounts" ,
869+ "nvmlMemoryErrorType_t" ,
870+ "errorType" ,
871+ "nvmlEccCounterType_t" ,
872+ "counterType" ,
873+ "nvmlEccErrorCounts_t" ,
930874 "eccCounts" ,
931- "nvmlEccErrorCounts_t{}" ,
932- nvml_server_device_two_args_stub (
933- "nvmlMemoryErrorType_t" ,
934- "nvmlEccCounterType_t" ,
935- "nvmlEccErrorCounts_t" ,
936- "nvmlEccErrorCounts_t{}" ,
937- ),
938875)
939- nvml_ecc_counter_stub (
876+ nvml_device_three_args_value (
940877 "nvmlDeviceGetMemoryErrorCounter" ,
941- "nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long *count" ,
878+ "nvmlMemoryErrorType_t" ,
879+ "errorType" ,
880+ "nvmlEccCounterType_t" ,
881+ "counterType" ,
882+ "nvmlMemoryLocation_t" ,
883+ "locationType" ,
884+ "unsigned long long" ,
942885 "count" ,
943- "0" ,
944- nvml_server_device_three_args_stub (
945- "nvmlMemoryErrorType_t" ,
946- "nvmlEccCounterType_t" ,
947- "nvmlMemoryLocation_t" ,
948- "unsigned long long" ,
949- "0" ,
950- ),
951886)
952887nvml_device_two_values (
953888 "nvmlDeviceGetEccMode" ,
@@ -2291,6 +2226,8 @@ def main():
22912226 with open ("gen_nvml_client.inc" , "w" ) as f :
22922227 f .write ("// Generated by codegen.py. Do not edit by hand.\n \n " )
22932228 for function in NVML_CODEGEN_FUNCTIONS :
2229+ if function ["name" ] in NVML_MANUAL_FUNCTIONS :
2230+ continue
22942231 f .write (
22952232 'extern "C" nvmlReturn_t {name}({params}) {{\n ' .format (
22962233 name = function ["name" ],
@@ -2307,6 +2244,8 @@ def main():
23072244 with open ("gen_nvml_server.inc" , "w" ) as f :
23082245 f .write ("// Generated by codegen.py. Do not edit by hand.\n \n " )
23092246 for function in NVML_CODEGEN_FUNCTIONS :
2247+ if function ["name" ] in NVML_MANUAL_FUNCTIONS :
2248+ continue
23102249 f .write (
23112250 "int handle_{name}(conn_t *conn) {{\n " .format (
23122251 name = function ["name" ],
@@ -2322,6 +2261,8 @@ def main():
23222261 with open ("gen_nvml_server.h" , "w" ) as f :
23232262 f .write ("// Generated by codegen.py. Do not edit by hand.\n \n " )
23242263 for function in NVML_CODEGEN_FUNCTIONS :
2264+ if function ["name" ] in NVML_MANUAL_FUNCTIONS :
2265+ continue
23252266 f .write (
23262267 "int handle_{name}(conn_t *conn);\n " .format (
23272268 name = function ["name" ],
0 commit comments