File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
ggml/src/ggml-remotingfrontend Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -47,15 +47,26 @@ ggml_backend_remoting_buffer_type_get_alignment(ggml_backend_buffer_type_t buft)
4747 IMPLEMENTED_ONCE;
4848 struct virtgpu *gpu = BUFT_TO_GPU (buft);
4949
50- return apir_buffer_type_get_alignment (gpu, buft);
50+ static size_t align = 0 ;
51+
52+ if (align == 0 ) {
53+ align = apir_buffer_type_get_alignment (gpu, buft);
54+ }
55+
56+ return align;
5157}
5258
5359static size_t
5460ggml_backend_remoting_buffer_type_get_max_size (ggml_backend_buffer_type_t buft) {
5561 IMPLEMENTED_ONCE;
5662 struct virtgpu *gpu = BUFT_TO_GPU (buft);
5763
58- return apir_buffer_type_get_max_size (gpu, buft);
64+ static size_t max_size = 0 ;
65+ if (max_size == 0 ) {
66+ max_size = apir_buffer_type_get_max_size (gpu, buft);
67+ }
68+
69+ return max_size;
5970}
6071
6172static bool
Original file line number Diff line number Diff line change @@ -23,7 +23,14 @@ ggml_backend_remoting_device_get_type(ggml_backend_dev_t dev) {
2323 IMPLEMENTED_ONCE;
2424 struct virtgpu *gpu = DEV_TO_GPU (dev);
2525
26- return (enum ggml_backend_dev_type) apir_device_get_type (gpu);
26+ static enum ggml_backend_dev_type type;
27+ static bool has_type = false ;
28+ if (!has_type) {
29+ has_type = true ;
30+ type = (enum ggml_backend_dev_type) apir_device_get_type (gpu);
31+ }
32+
33+ return type;
2734}
2835
2936static void
You can’t perform that action at this time.
0 commit comments