Show warning about bad opencl runtime on intel cpu only once
[hashcat.git] / src / hashcat.c
index 42c41c6..031ee99 100644 (file)
@@ -3818,8 +3818,6 @@ static void *thread_monitor (void *p)
   #ifdef HAVE_HWMON
   uint hwmon_check   = 0;
 
-  int slowdown_warnings = 0;
-
   // these variables are mainly used for fan control
 
   int *fan_speed_chgd = (int *) mycalloc (data.devices_cnt, sizeof (int));
@@ -3884,50 +3882,6 @@ static void *thread_monitor (void *p)
 
     #ifdef HAVE_HWMON
 
-    if (1)
-    {
-      hc_thread_mutex_lock (mux_adl);
-
-      for (uint device_id = 0; device_id < data.devices_cnt; device_id++)
-      {
-        hc_device_param_t *device_param = &data.devices_param[device_id];
-
-        if (device_param->skipped) continue;
-
-        if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) continue;
-
-        const int temperature = hm_get_temperature_with_device_id (device_id);
-
-        const int threshold = data.hm_device[device_id].gpu_temp_threshold_slowdown;
-
-        if (temperature >= threshold)
-        {
-          if (slowdown_warnings < 3)
-          {
-            if (data.quiet == 0) clear_prompt ();
-
-            log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold, device_id + 1);
-
-            if (slowdown_warnings == 2)
-            {
-              log_info ("");
-            }
-
-            if (data.quiet == 0) fprintf (stdout, "%s", PROMPT);
-            if (data.quiet == 0) fflush (stdout);
-
-            slowdown_warnings++;
-          }
-        }
-        else
-        {
-          slowdown_warnings = 0;
-        }
-      }
-
-      hc_thread_mutex_unlock (mux_adl);
-    }
-
     if (hwmon_check == 1)
     {
       hc_thread_mutex_lock (mux_adl);
@@ -4005,7 +3959,7 @@ static void *thread_monitor (void *p)
                 {
                   if (device_param->device_vendor_id == VENDOR_ID_AMD)
                   {
-                    hm_set_fanspeed_with_device_id_amd (device_id, fan_speed_new, 1);
+                    hm_set_fanspeed_with_device_id_adl (device_id, fan_speed_new, 1);
                   }
                   else if (device_param->device_vendor_id == VENDOR_ID_NV)
                   {
@@ -5435,8 +5389,8 @@ void SetConsoleWindowSize (const int x)
 
   COORD co;
 
-  co.X = sr->Right  + 1;
-  co.Y = sr->Bottom + 1;
+  co.X = sr->Right + 1;
+  co.Y = 9999;
 
   if (!SetConsoleScreenBufferSize (h, co)) return;
 
@@ -13318,8 +13272,9 @@ int main (int argc, char **argv)
      * OpenCL devices: simply push all devices from all platforms into the same device array
      */
 
-    int need_adl  = 0;
-    int need_nvml = 0;
+    int need_adl   = 0;
+    int need_nvapi = 0;
+    int need_nvml  = 0;
 
     hc_device_param_t *devices_param = (hc_device_param_t *) mycalloc (DEVICES_MAX, sizeof (hc_device_param_t));
 
@@ -13577,7 +13532,7 @@ int main (int argc, char **argv)
 
         if (device_endian_little == CL_FALSE)
         {
-          if (data.quiet == 0) log_info ("Device #%u: WARNING: not little endian device", device_id + 1);
+          log_info ("Device #%u: WARNING: not little endian device", device_id + 1);
 
           device_param->skipped = 1;
         }
@@ -13590,7 +13545,7 @@ int main (int argc, char **argv)
 
         if (device_available == CL_FALSE)
         {
-          if (data.quiet == 0) log_info ("Device #%u: WARNING: device not available", device_id + 1);
+          log_info ("Device #%u: WARNING: device not available", device_id + 1);
 
           device_param->skipped = 1;
         }
@@ -13603,7 +13558,7 @@ int main (int argc, char **argv)
 
         if (device_compiler_available == CL_FALSE)
         {
-          if (data.quiet == 0) log_info ("Device #%u: WARNING: device no compiler available", device_id + 1);
+          log_info ("Device #%u: WARNING: device no compiler available", device_id + 1);
 
           device_param->skipped = 1;
         }
@@ -13616,7 +13571,7 @@ int main (int argc, char **argv)
 
         if ((device_execution_capabilities & CL_EXEC_KERNEL) == 0)
         {
-          if (data.quiet == 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id + 1);
+          log_info ("Device #%u: WARNING: device does not support executing kernels", device_id + 1);
 
           device_param->skipped = 1;
         }
@@ -13633,14 +13588,14 @@ int main (int argc, char **argv)
 
         if (strstr (device_extensions, "base_atomics") == 0)
         {
-          if (data.quiet == 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id + 1);
+          log_info ("Device #%u: WARNING: device does not support base atomics", device_id + 1);
 
           device_param->skipped = 1;
         }
 
         if (strstr (device_extensions, "byte_addressable_store") == 0)
         {
-          if (data.quiet == 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id + 1);
+          log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id + 1);
 
           device_param->skipped = 1;
         }
@@ -13655,7 +13610,7 @@ int main (int argc, char **argv)
 
         if (device_local_mem_size < 32768)
         {
-          if (data.quiet == 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id + 1);
+          log_info ("Device #%u: WARNING: device local mem size is too small", device_id + 1);
 
           device_param->skipped = 1;
         }
@@ -13670,9 +13625,16 @@ int main (int argc, char **argv)
         {
           if (device_param->device_vendor_id == VENDOR_ID_AMD_USE_INTEL)
           {
-            if (data.quiet == 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id + 1);
+            if (data.force == 0)
+            {
+              if (algorithm_pos == 0)
+              {
+                log_info ("Device #%u: WARNING: not native intel opencl runtime, expect massive speed loss", device_id + 1);
+                log_info ("           You can use --force to override this but do not post error reports if you do so");
+              }
 
-            device_param->skipped = 1;
+              device_param->skipped = 1;
+            }
           }
         }
 
@@ -13721,6 +13683,10 @@ int main (int argc, char **argv)
           if ((device_param->platform_vendor_id == VENDOR_ID_NV) && (device_param->device_vendor_id == VENDOR_ID_NV))
           {
             need_nvml = 1;
+
+            #ifdef _WIN
+            need_nvapi = 1;
+            #endif
           }
         }
 
@@ -13995,68 +13961,93 @@ int main (int argc, char **argv)
      */
 
     #ifdef HAVE_HWMON
-    hm_attrs_t hm_adapters_nv[DEVICES_MAX]  = { { { 0 }, 0, 0, 0, 0, 0 } };
-    hm_attrs_t hm_adapters_amd[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0, 0 } };
+    hm_attrs_t hm_adapters_adl[DEVICES_MAX]   = { { 0 } };
+    hm_attrs_t hm_adapters_nvapi[DEVICES_MAX] = { { 0 } };
+    hm_attrs_t hm_adapters_nvml[DEVICES_MAX]  = { { 0 } };
 
     if (gpu_temp_disable == 0)
     {
-      NVML_PTR *nvml = (NVML_PTR *) mymalloc (sizeof (NVML_PTR));
-      ADL_PTR  *adl  = (ADL_PTR *)  mymalloc (sizeof (ADL_PTR));
+      ADL_PTR   *adl   = (ADL_PTR *)   mymalloc (sizeof (ADL_PTR));
+      NVAPI_PTR *nvapi = (NVAPI_PTR *) mymalloc (sizeof (NVAPI_PTR));
+      NVML_PTR  *nvml  = (NVML_PTR *)  mymalloc (sizeof (NVML_PTR));
 
-      data.hm_amd = NULL;
-      data.hm_nv  = NULL;
+      data.hm_adl   = NULL;
+      data.hm_nvapi = NULL;
+      data.hm_nvml  = NULL;
 
       if ((need_nvml == 1) && (nvml_init (nvml) == 0))
       {
-        data.hm_nv = nvml;
+        data.hm_nvml = nvml;
       }
 
-      if (data.hm_nv)
+      if (data.hm_nvml)
       {
-        if (hm_NVML_nvmlInit (data.hm_nv) == NVML_SUCCESS)
+        if (hm_NVML_nvmlInit (data.hm_nvml) == NVML_SUCCESS)
         {
-          HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX] = { 0 };
+          HM_ADAPTER_NVML nvmlGPUHandle[DEVICES_MAX] = { 0 };
 
-          int tmp_in = hm_get_adapter_index_nv (nvGPUHandle);
+          int tmp_in = hm_get_adapter_index_nvml (nvmlGPUHandle);
 
           int tmp_out = 0;
 
           for (int i = 0; i < tmp_in; i++)
           {
-            hm_adapters_nv[tmp_out++].adapter_index.nv = nvGPUHandle[i];
+            hm_adapters_nvml[tmp_out++].nvml = nvmlGPUHandle[i];
           }
 
           for (int i = 0; i < tmp_out; i++)
           {
             unsigned int speed;
 
-            if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nv, 0, hm_adapters_nv[i].adapter_index.nv, &speed) == NVML_SUCCESS) hm_adapters_nv[i].fan_get_supported = 1;
+            if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nvml, 0, hm_adapters_nvml[i].nvml, &speed) == NVML_SUCCESS) hm_adapters_nvml[i].fan_get_supported = 1;
+
+            hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
+
+            hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
+          }
+        }
+      }
+
+      if ((need_nvapi == 1) && (nvapi_init (nvapi) == 0))
+      {
+        data.hm_nvapi = nvapi;
+      }
+
+      if (data.hm_nvapi)
+      {
+        if (hm_NvAPI_Initialize (data.hm_nvapi) == NVAPI_OK)
+        {
+          HM_ADAPTER_NVAPI nvGPUHandle[DEVICES_MAX] = { 0 };
+
+          int tmp_in = hm_get_adapter_index_nvapi (nvGPUHandle);
 
-            hm_NVML_nvmlDeviceSetComputeMode (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
+          int tmp_out = 0;
 
-            hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, NVML_GOM_ALL_ON);
+          for (int i = 0; i < tmp_in; i++)
+          {
+            hm_adapters_nvapi[tmp_out++].nvapi = nvGPUHandle[i];
           }
         }
       }
 
       if ((need_adl == 1) && (adl_init (adl) == 0))
       {
-        data.hm_amd = adl;
+        data.hm_adl = adl;
       }
 
-      if (data.hm_amd)
+      if (data.hm_adl)
       {
-        if (hm_ADL_Main_Control_Create (data.hm_amd, ADL_Main_Memory_Alloc, 0) == ADL_OK)
+        if (hm_ADL_Main_Control_Create (data.hm_adl, ADL_Main_Memory_Alloc, 0) == ADL_OK)
         {
           // total number of adapters
 
           int hm_adapters_num;
 
-          if (get_adapters_num_amd (data.hm_amd, &hm_adapters_num) != 0) return (-1);
+          if (get_adapters_num_adl (data.hm_adl, &hm_adapters_num) != 0) return (-1);
 
           // adapter info
 
-          LPAdapterInfo lpAdapterInfo = hm_get_adapter_info_amd (data.hm_amd, hm_adapters_num);
+          LPAdapterInfo lpAdapterInfo = hm_get_adapter_info_adl (data.hm_adl, hm_adapters_num);
 
           if (lpAdapterInfo == NULL) return (-1);
 
@@ -14070,12 +14061,12 @@ int main (int argc, char **argv)
           {
             hc_thread_mutex_lock (mux_adl);
 
-            // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
+            // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
 
-            hm_get_adapter_index_amd (hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
+            hm_get_adapter_index_adl (hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
 
-            hm_get_overdrive_version  (data.hm_amd, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
-            hm_check_fanspeed_control (data.hm_amd, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
+            hm_get_overdrive_version  (data.hm_adl, hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
+            hm_check_fanspeed_control (data.hm_adl, hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
 
             hc_thread_mutex_unlock (mux_adl);
           }
@@ -14085,7 +14076,7 @@ int main (int argc, char **argv)
         }
       }
 
-      if (data.hm_amd == NULL && data.hm_nv == NULL)
+      if (data.hm_adl == NULL && data.hm_nvml == NULL)
       {
         gpu_temp_disable = 1;
       }
@@ -14174,7 +14165,7 @@ int main (int argc, char **argv)
        */
 
       #ifdef HAVE_HWMON
-      if (gpu_temp_disable == 0 && data.hm_amd == NULL && data.hm_nv == NULL)
+      if (gpu_temp_disable == 0 && data.hm_adl == NULL && data.hm_nvml == NULL)
       {
         log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
       }
@@ -14221,12 +14212,12 @@ int main (int argc, char **argv)
 
         if (device_param->device_vendor_id == VENDOR_ID_NV)
         {
-          memcpy (&data.hm_device[device_id], &hm_adapters_nv[platform_devices_id], sizeof (hm_attrs_t));
+          memcpy (&data.hm_device[device_id], &hm_adapters_nvml[platform_devices_id], sizeof (hm_attrs_t));
         }
 
         if (device_param->device_vendor_id == VENDOR_ID_AMD)
         {
-          memcpy (&data.hm_device[device_id], &hm_adapters_amd[platform_devices_id], sizeof (hm_attrs_t));
+          memcpy (&data.hm_device[device_id], &hm_adapters_adl[platform_devices_id], sizeof (hm_attrs_t));
         }
       }
     }
@@ -14263,7 +14254,7 @@ int main (int argc, char **argv)
 
             int powertune_supported = 0;
 
-            if ((ADL_rc = hm_ADL_Overdrive6_PowerControl_Caps (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
+            if ((ADL_rc = hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adl, &powertune_supported)) != ADL_OK)
             {
               log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
 
@@ -14278,9 +14269,9 @@ int main (int argc, char **argv)
 
               ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
 
-              if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune)) == ADL_OK)
+              if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adl, &powertune)) == ADL_OK)
               {
-                ADL_rc = hm_ADL_Overdrive_PowerControl_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &od_power_control_status[device_id]);
+                ADL_rc = hm_ADL_Overdrive_PowerControl_Get (data.hm_adl, data.hm_device[device_id].adl, &od_power_control_status[device_id]);
               }
 
               if (ADL_rc != ADL_OK)
@@ -14290,7 +14281,7 @@ int main (int argc, char **argv)
                 return (-1);
               }
 
-              if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
+              if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, powertune.iMaxValue)) != ADL_OK)
               {
                 log_error ("ERROR: Failed to set new ADL PowerControl values");
 
@@ -14303,7 +14294,7 @@ int main (int argc, char **argv)
 
               od_clock_mem_status[device_id].state.iNumberOfPerformanceLevels = 2;
 
-              if ((ADL_rc = hm_ADL_Overdrive_StateInfo_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
+              if ((ADL_rc = hm_ADL_Overdrive_StateInfo_Get (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
               {
                 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
 
@@ -14314,7 +14305,7 @@ int main (int argc, char **argv)
 
               ADLOD6Capabilities caps = {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
 
-              if ((ADL_rc = hm_ADL_Overdrive_Capabilities_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &caps)) != ADL_OK)
+              if ((ADL_rc = hm_ADL_Overdrive_Capabilities_Get (data.hm_adl, data.hm_device[device_id].adl, &caps)) != ADL_OK)
               {
                 log_error ("ERROR: Failed to get ADL device capabilities");
 
@@ -14351,7 +14342,7 @@ int main (int argc, char **argv)
               performance_state->aLevels[0].iMemoryClock = memory_clock_profile_max;
               performance_state->aLevels[1].iMemoryClock = memory_clock_profile_max;
 
-              if ((ADL_rc = hm_ADL_Overdrive_State_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
+              if ((ADL_rc = hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
               {
                 log_info ("ERROR: Failed to set ADL performance state");
 
@@ -14368,14 +14359,14 @@ int main (int argc, char **argv)
               // powertune set
               ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
 
-              if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune)) != ADL_OK)
+              if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adl, &powertune)) != ADL_OK)
               {
                 log_error ("ERROR: Failed to get current ADL PowerControl settings");
 
                 return (-1);
               }
 
-              if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
+              if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, powertune.iMaxValue)) != ADL_OK)
               {
                 log_error ("ERROR: Failed to set new ADL PowerControl values");
 
@@ -14393,7 +14384,7 @@ int main (int argc, char **argv)
 
           int powertune_supported = 0;
 
-          if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, &limit) == NVML_SUCCESS)
+          if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, &limit) == NVML_SUCCESS)
           {
             powertune_supported = 1;
           }
@@ -14405,11 +14396,11 @@ int main (int argc, char **argv)
             unsigned int minLimit;
             unsigned int maxLimit;
 
-            if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, &minLimit, &maxLimit) == NVML_SUCCESS)
+            if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nvml, 0, data.hm_device[device_id].nvml, &minLimit, &maxLimit) == NVML_SUCCESS)
             {
               if (maxLimit > 0)
               {
-                if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, maxLimit) == NVML_SUCCESS)
+                if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, maxLimit) == NVML_SUCCESS)
                 {
                   // now we can be sure we need to reset later
 
@@ -15704,21 +15695,6 @@ int main (int argc, char **argv)
 
       #if defined(HAVE_HWMON)
 
-      /**
-       * Store thermal target temperature so we can send a notice to user
-       */
-
-      if (gpu_temp_disable == 0)
-      {
-        const int gpu_temp_threshold_slowdown = hm_get_threshold_slowdown_with_device_id (device_id);
-        const int gpu_temp_threshold_shutdown = hm_get_threshold_slowdown_with_device_id (device_id);
-
-        data.hm_device[device_id].gpu_temp_threshold_slowdown = (gpu_temp_threshold_slowdown > 0) ? gpu_temp_threshold_slowdown : 10000;
-        data.hm_device[device_id].gpu_temp_threshold_shutdown = (gpu_temp_threshold_shutdown > 0) ? gpu_temp_threshold_shutdown : 10000;
-
-        // we could use those numbers for gpu_temp_retain and gpu_temp_abort, too
-      }
-
       /**
        * Store initial fanspeed if gpu_temp_retain is enabled
        */
@@ -15748,7 +15724,7 @@ int main (int argc, char **argv)
 
               if (device_param->device_vendor_id == VENDOR_ID_AMD)
               {
-                rc = hm_set_fanspeed_with_device_id_amd (device_id, fanspeed, 1);
+                rc = hm_set_fanspeed_with_device_id_adl (device_id, fanspeed, 1);
               }
               else if (device_param->device_vendor_id == VENDOR_ID_NV)
               {
@@ -17928,7 +17904,7 @@ int main (int argc, char **argv)
 
               if (device_param->device_vendor_id == VENDOR_ID_AMD)
               {
-                rc = hm_set_fanspeed_with_device_id_amd (device_id, fanspeed, 0);
+                rc = hm_set_fanspeed_with_device_id_adl (device_id, fanspeed, 0);
               }
               else if (device_param->device_vendor_id == VENDOR_ID_NV)
               {
@@ -17964,7 +17940,7 @@ int main (int argc, char **argv)
 
             int powertune_supported = 0;
 
-            if ((hm_ADL_Overdrive6_PowerControl_Caps (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
+            if ((hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adl, &powertune_supported)) != ADL_OK)
             {
               log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
 
@@ -17975,7 +17951,7 @@ int main (int argc, char **argv)
             {
               // powercontrol settings
 
-              if ((hm_ADL_Overdrive_PowerControl_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, od_power_control_status[device_id])) != ADL_OK)
+              if ((hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, od_power_control_status[device_id])) != ADL_OK)
               {
                 log_info ("ERROR: Failed to restore the ADL PowerControl values");
 
@@ -17993,7 +17969,7 @@ int main (int argc, char **argv)
               performance_state->aLevels[0].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[0].iMemoryClock;
               performance_state->aLevels[1].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock;
 
-              if ((hm_ADL_Overdrive_State_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
+              if ((hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
               {
                 log_info ("ERROR: Failed to restore ADL performance state");
 
@@ -18011,7 +17987,7 @@ int main (int argc, char **argv)
 
           if (limit > 0)
           {
-            hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, limit);
+            hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, limit);
           }
         }
       }
@@ -18021,22 +17997,22 @@ int main (int argc, char **argv)
 
     if (gpu_temp_disable == 0)
     {
-      if (data.hm_nv)
+      if (data.hm_nvml)
       {
-        hm_NVML_nvmlShutdown (data.hm_nv);
+        hm_NVML_nvmlShutdown (data.hm_nvml);
 
-        nvml_close (data.hm_nv);
+        nvml_close (data.hm_nvml);
 
-        data.hm_nv = NULL;
+        data.hm_nvml = NULL;
       }
 
-      if (data.hm_amd)
+      if (data.hm_adl)
       {
-        hm_ADL_Main_Control_Destroy (data.hm_amd);
+        hm_ADL_Main_Control_Destroy (data.hm_adl);
 
-        adl_close (data.hm_amd);
+        adl_close (data.hm_adl);
 
-        data.hm_amd = NULL;
+        data.hm_adl = NULL;
       }
     }
     #endif // HAVE_HWMON