char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Martin Changggml-et: Initial ET backend (#24179)082b326fc

char/aliceai-t5-moe
1.1 KiB36 linesraw
1#include "ggml-et-memops.h"
2
3#include "ggml-et-kernels.h"
4#include "ggml-impl.h"
5
6// Kernel parameter structure for memset operation
7struct memset_params {
8    uint32_t op_type;  // GGML_ET_MEMOP_MEMSET
9    uint32_t value;    // Value to set (extended to uint32_t for alignment)
10    void *   dst_ptr;  // Destination device pointer
11    size_t   size;     // Number of bytes to set
12};
13
14bool ggml_et_memset(ggml_backend_et_device_context * dev_ctx, void * dst_ptr, uint8_t value, size_t size) {
15    if (!dev_ctx || !dst_ptr || size == 0) {
16        GGML_LOG_ERROR("ET: Invalid memset parameters\n");
17        return false;
18    }
19
20    // Prepare kernel parameters
21    memset_params params;
22    params.op_type = GGML_ET_MEMOP_MEMSET;
23    params.value   = value;
24    params.dst_ptr = dst_ptr;
25    params.size    = size;
26
27    // Launch memops kernel (will lazy-load if not already loaded)
28    bool success = ggml_et_launch_kernel(dev_ctx, "memops", &params, sizeof(params));
29
30    if (!success) {
31        GGML_LOG_ERROR("ET: memset kernel launch failed\n");
32        return false;
33    }
34
35    return true;
36}