Introduce opencl_ctx_t; not finished yet

This commit is contained in:
jsteube
2016-09-15 16:02:52 +02:00
parent d60e2529c1
commit 7ce2f2ff19
33 changed files with 2013 additions and 1865 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
#define OPENCL_VECTOR_WIDTH 0
int autotune (hc_device_param_t *device_param, hashconfig_t *hashconfig);
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig);
void *thread_autotune (void *p);
+3 -11
View File
@@ -26,11 +26,9 @@ typedef struct
* threads
*/
uint devices_status;
uint devices_cnt;
uint devices_active;
hc_device_param_t *devices_param;
opencl_ctx_t *opencl_ctx;
uint shutdown_inner;
uint shutdown_outer;
@@ -74,12 +72,6 @@ typedef struct
int rule_len_l;
int rule_len_r;
/**
* opencl library stuff
*/
void *ocl;
/**
* hardware watchdog
*/
@@ -181,7 +173,7 @@ typedef struct
char *truecrypt_keyfiles;
char *veracrypt_keyfiles;
uint veracrypt_pim;
uint workload_profile;
char *custom_charset_1;
char *custom_charset_2;
char *custom_charset_3;
+2 -2
View File
@@ -15,8 +15,8 @@ int sort_by_hash_no_salt (const void *v1, const void *v2);
void save_hash ();
void check_hash (hc_device_param_t *device_param, plain_t *plain);
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, plain_t *plain);
int check_cracked (hc_device_param_t *device_param, const uint salt_pos, hashconfig_t *hashconfig);
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint salt_pos, hashconfig_t *hashconfig);
#endif // _HASH_MANAGEMENT_H
+10 -10
View File
@@ -42,16 +42,16 @@ int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_
// int hm_get_device_num (void *adl, HM_ADAPTER_ADL hm_adapter_index, int *hm_device_num);
// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
int hm_get_threshold_slowdown_with_device_id (const uint device_id);
int hm_get_threshold_shutdown_with_device_id (const uint device_id);
int hm_get_temperature_with_device_id (const uint device_id);
int hm_get_fanspeed_with_device_id (const uint device_id);
int hm_get_fanpolicy_with_device_id (const uint device_id);
int hm_get_buslanes_with_device_id (const uint device_id);
int hm_get_utilization_with_device_id (const uint device_id);
int hm_get_memoryspeed_with_device_id (const uint device_id);
int hm_get_corespeed_with_device_id (const uint device_id);
int hm_get_throttle_with_device_id (const uint device_id);
int hm_get_threshold_slowdown_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_threshold_shutdown_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_temperature_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanspeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanpolicy_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_buslanes_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_utilization_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_memoryspeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_corespeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_throttle_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_nvapi (const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed);
+59 -13
View File
@@ -224,25 +224,71 @@ struct __hc_device_param
u32 kernel_params_memset_buf32[PARAMCNT];
};
uint setup_opencl_platforms_filter (char *opencl_platforms);
u32 setup_devices_filter (char *opencl_devices);
cl_device_type setup_device_types_filter (char *opencl_device_types);
typedef struct
{
int disable;
void *ocl;
cl_uint platforms_cnt;
cl_platform_id *platforms;
cl_uint platform_devices_cnt;
cl_device_id *platform_devices;
u32 devices_cnt;
u32 devices_active;
hc_device_param_t *devices_param;
u32 devices_status;
u32 opencl_platforms_filter;
u32 devices_filter;
cl_device_type device_types_filter;
u32 opencl_vector_width;
u32 opencl_vector_width_chgd;
u32 nvidia_spin_damp;
u32 nvidia_spin_damp_chgd;
uint kernel_loops;
uint kernel_loops_chgd;
uint kernel_accel;
uint kernel_accel_chgd;
uint workload_profile;
int need_adl;
int need_nvml;
int need_nvapi;
int need_xnvctrl;
} opencl_ctx_t;
void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources);
void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
int gidd_to_pw_t (hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
int gidd_to_pw_t (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
int choose_kernel (hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint attack_exec, const uint attack_mode, const uint opts_type, const salt_t *salt_buf, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration);
int run_kernel (const uint kern_run, hc_device_param_t *device_param, const uint num, const uint event_update, const uint iteration, hashconfig_t *hashconfig);
int run_kernel_mp (const uint kern_run, hc_device_param_t *device_param, const uint num);
int run_kernel_tm (hc_device_param_t *device_param);
int run_kernel_amp (hc_device_param_t *device_param, const uint num);
int run_kernel_memset (hc_device_param_t *device_param, cl_mem buf, const uint value, const uint num);
int run_kernel_bzero (hc_device_param_t *device_param, cl_mem buf, const size_t size);
int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint attack_exec, const uint attack_mode, const uint opts_type, const salt_t *salt_buf, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration);
int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num, const uint event_update, const uint iteration, hashconfig_t *hashconfig);
int run_kernel_mp (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num);
int run_kernel_tm (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param);
int run_kernel_amp (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num);
int run_kernel_memset (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cl_mem buf, const uint value, const uint num);
int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cl_mem buf, const size_t size);
int run_copy (hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint pws_cnt);
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint pws_cnt);
int run_cracker (hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint pws_cnt);
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint pws_cnt);
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const char *opencl_platforms, const char *opencl_devices, const char *opencl_device_types, const uint opencl_vector_width, const uint opencl_vector_width_chgd, const uint nvidia_spin_damp, const uint nvidia_spin_damp_chgd, const uint workload_profile, const uint kernel_accel, const uint kernel_accel_chgd, const uint kernel_loops, const uint kernel_loops_chgd, const uint keyspace, const uint stdout_flag);
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const tuning_db_t *tuning_db, const uint attack_mode, const uint quiet, const uint force, const uint benchmark, const uint machine_readable, const uint algorithm_pos);
void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx);
#endif // _OPENCL_H
+5 -5
View File
@@ -47,18 +47,18 @@ typedef struct
} restore_data_t;
u64 get_lowest_words_done ();
u64 get_lowest_words_done (opencl_ctx_t *opencl_ctx);
restore_data_t *init_restore (int argc, char **argv);
void read_restore (const char *eff_restore_file, restore_data_t *rd);
void write_restore (const char *new_restore_file, restore_data_t *rd);
void write_restore (opencl_ctx_t *opencl_ctx, const char *new_restore_file, restore_data_t *rd);
void cycle_restore ();
void cycle_restore (opencl_ctx_t *opencl_ctx);
void check_checkpoint ();
void check_checkpoint (opencl_ctx_t *opencl_ctx);
void stop_at_checkpoint ();
void stop_at_checkpoint (opencl_ctx_t *opencl_ctx);
#endif // _RESTORE_H
+4 -4
View File
@@ -31,9 +31,9 @@ typedef enum status_rc
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
void status_display_machine_readable ();
void status_display ();
void status_benchmark_automate ();
void status_benchmark ();
void status_display_machine_readable (opencl_ctx_t *opencl_ctx);
void status_display (opencl_ctx_t *opencl_ctx);
void status_benchmark_automate (opencl_ctx_t *opencl_ctx);
void status_benchmark (opencl_ctx_t *opencl_ctx);
#endif // _STATUS_H
+1 -1
View File
@@ -31,6 +31,6 @@ typedef struct
} out_t;
void process_stdout (hc_device_param_t *device_param, const uint pws_cnt);
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint pws_cnt);
#endif // _STDOUT_H
+5 -5
View File
@@ -62,12 +62,12 @@ void hc_signal (void (callback) (int));
#endif
void myabort ();
void myquit ();
void myabort (opencl_ctx_t *opencl_ctx);
void myquit (opencl_ctx_t *opencl_ctx);
void SuspendThreads ();
void ResumeThreads ();
void SuspendThreads (opencl_ctx_t *opencl_ctx);
void ResumeThreads (opencl_ctx_t *opencl_ctx);
void bypass ();
void bypass (opencl_ctx_t *opencl_ctx);
#endif // _THREAD_H
+1 -1
View File
@@ -43,6 +43,6 @@ typedef struct
void tuning_db_destroy (tuning_db_t *tuning_db);
tuning_db_t *tuning_db_alloc (FILE *fp);
tuning_db_t *tuning_db_init (const char *tuning_db_file);
tuning_db_entry_t *tuning_db_search (tuning_db_t *tuning_db, hc_device_param_t *device_param, int attack_mode, int hash_type);
tuning_db_entry_t *tuning_db_search (const tuning_db_t *tuning_db, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type);
#endif // _TUNINGDB_H
+1 -1
View File
@@ -8,6 +8,6 @@
#define WEAK_HASH_THRESHOLD 100
void weak_hash_check (hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint salt_pos);
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint salt_pos);
#endif // _WEAK_HASH_H