Skip to content

Commit 4cf39ae

Browse files
committed
ggml-zdnn: switch to common.hpp
Signed-off-by: Aaron Teo <[email protected]>
1 parent 996c66c commit 4cf39ae

File tree

3 files changed

+52
-61
lines changed

3 files changed

+52
-61
lines changed

ggml/src/ggml-zdnn/common.hpp

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,57 @@
33

44
#include "ggml.h"
55
#include "ggml-impl.h"
6-
#include "ggml-zdnn-impl.h"
76

87
#include "zdnn.h"
98

9+
#include <vector>
10+
#include <memory>
11+
12+
#define GGML_ZDNN_NAME "zDNN"
13+
#define GGML_ZDNN_VERSION ZDNN_VERNUM
14+
15+
#define ZDNN_CHECK(stmt) \
16+
do { \
17+
zdnn_status status = (stmt); \
18+
GGML_ASSERT(status == ZDNN_OK); \
19+
} while (0);
20+
21+
struct ggml_backend_zdnn_device_context {
22+
int zdnn_device;
23+
int zdnn_device_ref_count;
24+
25+
bool has_parmblkformat_0;
26+
bool has_parmblkformat_1; // checks for z17
27+
28+
size_t max_size;
29+
30+
char name[128];
31+
};
32+
33+
struct ggml_backend_zdnn_context {
34+
int device;
35+
ggml_cgraph * gf;
36+
};
37+
38+
struct ggml_backend_zdnn_buffer {
39+
void * data;
40+
ggml_backend_zdnn_buffer * extra; // for bias, etc.
41+
size_t size;
42+
43+
zdnn_tensor_desc pre_tfm_desc;
44+
zdnn_tensor_desc tfm_desc;
45+
zdnn_ztensor ztensor;
46+
47+
char name[GGML_MAX_NAME];
48+
};
49+
50+
struct ggml_backend_zdnn_buffer_context {
51+
void * all_data;
52+
size_t all_size;
53+
bool owned;
54+
55+
int n_buffers;
56+
std::vector<std::unique_ptr<ggml_backend_zdnn_buffer>> buffers;
57+
};
58+
1059
#endif // GGML_ZDNN_COMMON_HPP

ggml/src/ggml-zdnn/ggml-zdnn-impl.hpp

Lines changed: 0 additions & 58 deletions
This file was deleted.

ggml/src/ggml-zdnn/ggml-zdnn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "ggml-zdnn-impl.hpp"
1+
#include "ggml-zdnn.h"
22
#include "ggml-impl.h"
33
#include "ggml-backend-impl.h"
44

@@ -8,7 +8,7 @@
88

99
#include <vector>
1010
#include <memory>
11-
#include <csignal>
11+
#include <csignal> // raise(SIGTRAP)
1212
#include <unistd.h>
1313

1414
inline zdnn_data_types ggml_zdnn_type_mapping(ggml_type type) {

0 commit comments

Comments
 (0)