Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ggml/src/ggml-sycl/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ inline dpct::err0 ggml_sycl_set_device(const int device) try {
//////////////////////
struct optimize_feature {
bool reorder=false;
bool xmx_pq2=false; // PQ2_0 rewritten into the XMX layout (pq2_xmx.hpp); only that path can read it
bool xmx_pq2=false; // PQ2_0/PTQ1_0 rewritten into the XMX layout (pq2_xmx.hpp); only that path can read it
};

struct sycl_device_info {
Expand Down Expand Up @@ -440,12 +440,17 @@ struct ggml_backend_sycl_context {

std::unique_ptr<ggml_sycl_pool> host_pools[GGML_SYCL_MAX_DEVICES];

// XMX activations shared across mat-muls are freed out of order, which the VMM pool does not allow
std::unique_ptr<ggml_sycl_pool> xmx_act_pools[GGML_SYCL_MAX_DEVICES];

std::vector<mmid_row_mapping> mmid_row_mapping_host;

static std::unique_ptr<ggml_sycl_pool> new_pool_for_device(queue_ptr qptr, int device);

static std::unique_ptr<ggml_sycl_pool> new_pool_for_host(queue_ptr qptr, int device);

static std::unique_ptr<ggml_sycl_pool> new_unordered_pool_for_device(queue_ptr qptr, int device);

static std::unique_ptr<ggml_sycl_fattn_kv_buffers> new_fattn_kv_buffers(queue_ptr qptr, int device);

ggml_sycl_pool & pool(int device) {
Expand All @@ -459,6 +464,13 @@ struct ggml_backend_sycl_context {
return pool(device);
}

ggml_sycl_pool & xmx_act_pool() {
if (xmx_act_pools[device] == nullptr) {
xmx_act_pools[device] = new_unordered_pool_for_device(stream(device, 0), device);
}
return *xmx_act_pools[device];
}

ggml_sycl_fattn_kv_buffers & fattn_buffers(int device) {
if (fattn_bufs[device] == nullptr) {
fattn_bufs[device] = new_fattn_kv_buffers(stream(device, 0), device);
Expand Down
Loading