Skip to content

Commit f5b6bd2

Browse files
authored
Merge pull request #5 from kpouget/msg
remoting: improve the logging messages
2 parents 8dcefbd + 3c83d3d commit f5b6bd2

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

ggml/src/ggml-remotingfrontend/ggml-backend-reg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ ggml_backend_reg_t ggml_backend_remoting_frontend_reg() {
148148
}
149149
initialized = true;
150150

151-
INFO("ggml_backend_remoting_frontend_reg() hello :wave:");
152-
153151
ggml_backend_remoting_reg_init_devices(&reg);
154152

155153
int cr = atexit(showTime);
156154
GGML_ASSERT(cr == 0);
157155

156+
MESSAGE("%s: initialzed", __func__);
157+
158158
return ®
159159
}

ggml/src/ggml-remotingfrontend/virtgpu-utils.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ inline void
4747
INFO(...) {}
4848
#endif
4949

50+
inline void
51+
MESSAGE(const char *format, ...) {
52+
fprintf(stderr, "APIR: ");
53+
54+
va_list argptr;
55+
va_start(argptr, format);
56+
vfprintf(stderr, format, argptr);
57+
fprintf(stderr, "\n");
58+
va_end(argptr);
59+
}
60+
5061
inline void
5162
WARNING(const char *format, ...) {
5263
fprintf(stderr, "WARNING: ");

ggml/src/ggml-remotingfrontend/virtgpu.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ virtgpu_open(struct virtgpu *gpu)
126126
drmDevicePtr devs[8];
127127
int count = drmGetDevices2(0, devs, ARRAY_SIZE(devs));
128128
if (count < 0) {
129-
INFO("failed to enumerate DRM devices");
129+
ERROR("failed to enumerate DRM devices");
130130
return APIR_ERROR_INITIALIZATION_FAILED;
131131
}
132132

@@ -223,7 +223,7 @@ virtgpu_open_device(struct virtgpu *gpu, const drmDevicePtr dev)
223223

224224
drmFreeVersion(version);
225225

226-
INFO("using DRM device %s", node_path);
226+
MESSAGE("using DRM device %s", node_path);
227227

228228
return APIR_SUCCESS;
229229
}
@@ -523,11 +523,11 @@ remote_call(
523523
double duration_s = (double) duration_ns / 1e9; // 1 second = 1e9 nanoseconds
524524

525525
if (duration_s > 1) {
526-
INFO("%s: waited %.2fs for the host reply...", __func__, duration_s);
526+
MESSAGE("%s: waited %.2fs for the host reply...", __func__, duration_s);
527527
} else if (duration_ms > 1) {
528-
INFO("%s: waited %.2fms for the host reply...", __func__, duration_ms);
528+
MESSAGE("%s: waited %.2fms for the host reply...", __func__, duration_ms);
529529
} else {
530-
INFO("%s: waited %lldns for the host reply...", __func__, duration_ns);
530+
MESSAGE("%s: waited %lldns for the host reply...", __func__, duration_ns);
531531
}
532532

533533
if (timeout) {

0 commit comments

Comments
 (0)