Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-et/ggml-et-common.h # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / src / ggml-et / ggml-et-common.h` 86 lines ยท 2582 bytes Raw Blame History 1 #pragma once 2 3 #include "ggml-backend-impl.h" 4 #include "ggml-et-uberkernel-common.h" 5 6 #include 7 #include 8 #include 9 10 #include 11 #include 12 #include 13 #include 14 #include 15 16 std::shared_ptr ggml_et_runtime(); 17 18 struct ggml_backend_et_buffer_type_context { 19 int devidx; 20 std::string name; 21 }; 22 23 struct ggml_backend_et_buffer_context { 24 int devidx; 25 void * data; // Device memory pointer 26 size_t size; 27 rt::DeviceId rtid; 28 }; 29 30 struct ggml_backend_et_context { 31 int devidx; 32 }; 33 34 struct ggml_backend_et_device_context; 35 36 // One slot in the uberkernel ring. The host vectors back the H2D copy and 37 // must outlive the upload; the device buffers feed the kernel that consumes 38 // them. pending_event lets us know when both have drained so the slot can 39 // be recycled. 40 struct ggml_backend_et_uberkernel_slot { 41 std::vector insts; 42 std::vector params_blob; 43 44 std::byte * device_insts = nullptr; 45 std::byte * device_params = nullptr; 46 size_t device_insts_capacity = 0; 47 size_t device_params_capacity = 0; 48 49 rt::EventId pending_event{}; 50 bool has_pending = false; 51 }; 52 53 struct ggml_backend_et_uberkernel_context { 54 bool failed = false; 55 uint64_t shire_mask = 0; 56 57 // Ring of slots. We accumulate into slots[current_slot]; on segment 58 // commit we fire the H2D + launch and rotate to the next slot, 59 // waiting on its previous launch only if it hasn't drained yet. 60 static constexpr size_t SLOT_COUNT = 4; 61 ggml_backend_et_uberkernel_slot slots[SLOT_COUNT]; 62 size_t current_slot = 0; 63 }; 64 65 struct ggml_backend_et_device_context { 66 int devidx; 67 rt::DeviceId rtid; 68 std::string name; 69 std::string desc; 70 size_t total_mem; 71 ggml_backend_buffer_type_t buftype; 72 73 // Kernel management - default stream for ordered execution on this device 74 rt::StreamId default_stream; 75 std::unordered_map loaded_kernels; 76 77 // trace buffer - for printing support 78 std::byte * trace_buffer; 79 80 bool uberkernel_enabled = false; 81 ggml_backend_et_uberkernel_context uberkernel; 82 }; 83 84 struct ggml_backend_et_reg_ctx { 85 std::vector devices; 86 };