Skip to content

Commit e47d526

Browse files
committed
Rename kernel_key to disk_key.
1 parent 388fc11 commit e47d526

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/gpuarray_buffer_cuda.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ static int cuda_records(gpudata *, int, CUstream);
4747
static int detect_arch(const char *prefix, char *ret, error *e);
4848
static gpudata *new_gpudata(cuda_context *ctx, CUdeviceptr ptr, size_t size);
4949

50-
typedef struct _kernel_key {
50+
typedef struct _disk_key {
5151
uint8_t version;
5252
uint8_t debug;
5353
uint8_t major;
5454
uint8_t minor;
5555
uint32_t reserved;
5656
char bin_id[64];
5757
strb src;
58-
} kernel_key;
58+
} disk_key;
5959

60-
/* Size of the kernel_key that we can memcopy to duplicate */
61-
#define KERNEL_KEY_MM (sizeof(kernel_key) - sizeof(strb))
60+
/* Size of the disk_key that we can memcopy to duplicate */
61+
#define DISK_KEY_MM (sizeof(disk_key) - sizeof(strb))
6262

6363
static void key_free(cache_key_t _k) {
64-
kernel_key *k = (kernel_key *)_k;
64+
disk_key *k = (disk_key *)_k;
6565
strb_clear(&k->src);
6666
free(k);
6767
}
@@ -75,41 +75,41 @@ static uint32_t strb_hash(strb *k) {
7575
return XXH32(k->s, k->l, 42);
7676
}
7777

78-
static int key_eq(kernel_key *k1, kernel_key *k2) {
79-
return (memcmp(k1, k2, KERNEL_KEY_MM) == 0 &&
78+
static int key_eq(disk_key *k1, disk_key *k2) {
79+
return (memcmp(k1, k2, DISK_KEY_MM) == 0 &&
8080
strb_eq(&k1->src, &k2->src));
8181
}
8282

83-
static int key_hash(kernel_key *k) {
83+
static int key_hash(disk_key *k) {
8484
XXH32_state_t state;
8585
XXH32_reset(&state, 42);
86-
XXH32_update(&state, k, KERNEL_KEY_MM);
86+
XXH32_update(&state, k, DISK_KEY_MM);
8787
XXH32_update(&state, k->src.s, k->src.l);
8888
return XXH32_digest(&state);
8989
}
9090

91-
static int key_write(strb *res, kernel_key *k) {
92-
strb_appendn(res, (const char *)k, KERNEL_KEY_MM);
91+
static int key_write(strb *res, disk_key *k) {
92+
strb_appendn(res, (const char *)k, DISK_KEY_MM);
9393
strb_appendb(res, &k->src);
9494
return strb_error(res);
9595
}
9696

97-
static kernel_key *key_read(const strb *b) {
98-
kernel_key *k;
99-
if (b->l < KERNEL_KEY_MM) return NULL;
97+
static disk_key *key_read(const strb *b) {
98+
disk_key *k;
99+
if (b->l < DISK_KEY_MM) return NULL;
100100
k = calloc(1, sizeof(*k));
101101
if (k == NULL) return NULL;
102-
memcpy(k, b->s, KERNEL_KEY_MM);
102+
memcpy(k, b->s, DISK_KEY_MM);
103103
if (k->version != 0) {
104104
free(k);
105105
return NULL;
106106
}
107-
if (strb_ensure(&k->src, b->l - KERNEL_KEY_MM) != 0) {
107+
if (strb_ensure(&k->src, b->l - DISK_KEY_MM) != 0) {
108108
strb_clear(&k->src);
109109
free(k);
110110
return NULL;
111111
}
112-
strb_appendn(&k->src, b->s + KERNEL_KEY_MM, b->l - KERNEL_KEY_MM);
112+
strb_appendn(&k->src, b->s + DISK_KEY_MM, b->l - DISK_KEY_MM);
113113
return k;
114114
}
115115

@@ -1190,8 +1190,8 @@ static int make_bin(cuda_context *ctx, const strb *ptx, strb *bin, strb *log) {
11901190
static int compile(cuda_context *ctx, strb *src, strb* bin, strb *log) {
11911191
strb ptx = STRB_STATIC_INIT;
11921192
strb *cbin;
1193-
kernel_key k;
1194-
kernel_key *pk;
1193+
disk_key k;
1194+
disk_key *pk;
11951195

11961196
memset(&k, 0, sizeof(k));
11971197
k.version = 0;
@@ -1217,14 +1217,14 @@ static int compile(cuda_context *ctx, strb *src, strb* bin, strb *log) {
12171217
GA_CHECK(make_bin(ctx, &ptx, bin, log));
12181218

12191219
if (ctx->disk_cache) {
1220-
pk = calloc(sizeof(kernel_key), 1);
1220+
pk = calloc(sizeof(disk_key), 1);
12211221
if (pk == NULL) {
12221222
error_sys(ctx->err, "calloc");
12231223
fprintf(stderr, "Error adding kernel to disk cache: %s\n",
12241224
ctx->err->msg);
12251225
return GA_NO_ERROR;
12261226
}
1227-
memcpy(pk, &k, KERNEL_KEY_MM);
1227+
memcpy(pk, &k, DISK_KEY_MM);
12281228
strb_appendb(&pk->src, src);
12291229
if (strb_error(&pk->src)) {
12301230
error_sys(ctx->err, "strb_appendb");

0 commit comments

Comments
 (0)