File: ext_nvrtc.h

package info (click to toggle)
hashcat 6.2.6%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 63,932 kB
  • sloc: lisp: 584,043; ansic: 372,246; perl: 24,890; cpp: 23,731; sh: 3,927; python: 868; makefile: 777
file content (99 lines) | stat: -rw-r--r-- 4,141 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
 * Author......: See docs/credits.txt
 * License.....: MIT
 */

#ifndef _EXT_NVRTC_H
#define _EXT_NVRTC_H

/**
 * from cuda.h (/usr/local/cuda-10.1/targets/x86_64-linux/include/nvrtc.h)
 */

/**
 * \ingroup error
 * \brief   The enumerated type nvrtcResult defines API call result codes.
 *          NVRTC API functions return nvrtcResult to indicate the call
 *          result.
 */
typedef enum {
  NVRTC_SUCCESS = 0,
  NVRTC_ERROR_OUT_OF_MEMORY = 1,
  NVRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
  NVRTC_ERROR_INVALID_INPUT = 3,
  NVRTC_ERROR_INVALID_PROGRAM = 4,
  NVRTC_ERROR_INVALID_OPTION = 5,
  NVRTC_ERROR_COMPILATION = 6,
  NVRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
  NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
  NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
  NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
  NVRTC_ERROR_INTERNAL_ERROR = 11
} nvrtcResult;

/**
 * \ingroup compilation
 * \brief   nvrtcProgram is the unit of compilation, and an opaque handle for
 *          a program.
 *
 * To compile a CUDA program string, an instance of nvrtcProgram must be
 * created first with ::nvrtcCreateProgram, then compiled with
 * ::nvrtcCompileProgram.
 */
typedef struct _nvrtcProgram *nvrtcProgram;

#ifdef _WIN32
#define NVRTCAPI __stdcall
#else
#define NVRTCAPI
#endif

#define NVRTC_API_CALL NVRTCAPI

typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCADDNAMEEXPRESSION)  (nvrtcProgram, const char * const);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCCOMPILEPROGRAM)     (nvrtcProgram, int, const char * const *);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCCREATEPROGRAM)      (nvrtcProgram *, const char *, const char *, int, const char * const *, const char * const *);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCDESTROYPROGRAM)     (nvrtcProgram *);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCGETLOWEREDNAME)     (nvrtcProgram, const char * const, const char **);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCGETPTX)             (nvrtcProgram, char *);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCGETPTXSIZE)         (nvrtcProgram, size_t *);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCGETPROGRAMLOG)      (nvrtcProgram, char *);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCGETPROGRAMLOGSIZE)  (nvrtcProgram, size_t *);
typedef const char * (NVRTC_API_CALL *NVRTC_NVRTCGETERRORSTRING)     (nvrtcResult);
typedef nvrtcResult  (NVRTC_API_CALL *NVRTC_NVRTCVERSION)            (int *, int *);

typedef struct hc_nvrtc_lib
{
  hc_dynlib_t lib;

  NVRTC_NVRTCADDNAMEEXPRESSION  nvrtcAddNameExpression;
  NVRTC_NVRTCCOMPILEPROGRAM     nvrtcCompileProgram;
  NVRTC_NVRTCCREATEPROGRAM      nvrtcCreateProgram;
  NVRTC_NVRTCDESTROYPROGRAM     nvrtcDestroyProgram;
  NVRTC_NVRTCGETLOWEREDNAME     nvrtcGetLoweredName;
  NVRTC_NVRTCGETPTX             nvrtcGetPTX;
  NVRTC_NVRTCGETPTXSIZE         nvrtcGetPTXSize;
  NVRTC_NVRTCGETPROGRAMLOG      nvrtcGetProgramLog;
  NVRTC_NVRTCGETPROGRAMLOGSIZE  nvrtcGetProgramLogSize;
  NVRTC_NVRTCGETERRORSTRING     nvrtcGetErrorString;
  NVRTC_NVRTCVERSION            nvrtcVersion;

} hc_nvrtc_lib_t;

typedef hc_nvrtc_lib_t NVRTC_PTR;

int nvrtc_make_options_array_from_string (char *string, char **options);

int  nvrtc_init                (void *hashcat_ctx);
void nvrtc_close               (void *hashcat_ctx);

int hc_nvrtcCreateProgram      (void *hashcat_ctx, nvrtcProgram *prog, const char *src, const char *name, int numHeaders, const char * const *headers, const char * const *includeNames);
int hc_nvrtcDestroyProgram     (void *hashcat_ctx, nvrtcProgram *prog);
int hc_nvrtcCompileProgram     (void *hashcat_ctx, nvrtcProgram prog, int numOptions, const char * const *options);
int hc_nvrtcGetProgramLogSize  (void *hashcat_ctx, nvrtcProgram prog, size_t *logSizeRet);
int hc_nvrtcGetProgramLog      (void *hashcat_ctx, nvrtcProgram prog, char *log);
int hc_nvrtcGetPTXSize         (void *hashcat_ctx, nvrtcProgram prog, size_t *ptxSizeRet);
int hc_nvrtcGetPTX             (void *hashcat_ctx, nvrtcProgram prog, char *ptx);
int hc_nvrtcVersion            (void *hashcat_ctx, int *major, int *minor);

#endif // _EXT_NVRTC_H