Skip to content

Commit 1929d27

Browse files
committed
SYCL: Some device info print refactoring and add details of XMX availability
1 parent c2a0a2a commit 1929d27

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

ggml/src/ggml-sycl/common.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ void ggml_sycl_host_free(void* ptr) try {
5151
std::exit(1);
5252
}
5353

54+
bool gpu_has_xmx(sycl::device &dev) {
55+
return dev.has(sycl::aspect::ext_intel_matrix);
56+
}
57+
5458
int64_t downsample_sycl_global_range(int64_t accumulate_block_num, int64_t block_size) {
5559
const int64_t max_range = std::numeric_limits<int>::max();
5660
int64_t sycl_down_blk_size = block_size;

ggml/src/ggml-sycl/common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ inline void ggml_sycl_op_bin_bcast(ggml_backend_sycl_context & ctx, const ggml_t
662662
}
663663
}
664664

665+
bool gpu_has_xmx(sycl::device &dev);
665666

666667
void ggml_sycl_op_flatten(ggml_backend_sycl_context & ctx, const ggml_tensor *src0,
667668
const ggml_tensor *src1, ggml_tensor *dst,

ggml/src/ggml-sycl/ggml-sycl.cpp

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,12 @@ static ggml_sycl_device_info ggml_sycl_init() {
5454
GGML_ASSERT(info.device_count <= GGML_SYCL_MAX_DEVICES);
5555

5656
int64_t total_vram = 0;
57-
#if defined(GGML_SYCL_FORCE_MMQ)
58-
GGML_LOG_INFO("%s: GGML_SYCL_FORCE_MMQ: yes\n", __func__);
59-
#else
60-
GGML_LOG_INFO("%s: GGML_SYCL_FORCE_MMQ: no\n", __func__);
61-
#endif
62-
#if defined(SYCL_USE_XMX)
63-
GGML_LOG_INFO("%s: SYCL_USE_XMX: yes\n", __func__);
64-
#else
65-
GGML_LOG_INFO("%s: SYCL_USE_XMX: no\n", __func__);
66-
#endif
67-
GGML_LOG_INFO("%s: found %d %s devices:\n", __func__, info.device_count, GGML_SYCL_NAME);
68-
57+
/* This is a bit misleading; reserved for later */
58+
// #if defined(SYCL_USE_XMX)
59+
// GGML_LOG_INFO("%s: SYCL_USE_XMX: yes\n", __func__);
60+
// #else
61+
// GGML_LOG_INFO("%s: SYCL_USE_XMX: no\n", __func__);
62+
// #endif
6963
for (int i = 0; i < info.device_count; ++i) {
7064
info.devices[i].vmm = 0;
7165
dpct::device_info prop;
@@ -109,11 +103,11 @@ void print_device_detail(int id, sycl::device &device, std::string device_type)
109103
name = std::regex_replace(name, std::regex("\\(TM\\)"), "");
110104

111105
auto global_mem_size = prop.get_global_mem_size()/1000000;
112-
113-
GGML_LOG_INFO("|%2d|%19s|%39s|%7s|%7d|%8d|%5d|%6luM|%21s|\n", id, device_type.c_str(),
106+
std::string xmx = gpu_has_xmx(device) ? "yes" : "no";
107+
GGML_LOG_INFO("|%2d|%19s|%39s|%7s|%7d|%8d|%5d|%6luM|%21s|%14s|\n", id, device_type.c_str(),
114108
name.c_str(), version.c_str(), prop.get_max_compute_units(),
115109
prop.get_max_work_group_size(), prop.get_max_sub_group_size(),
116-
global_mem_size, device.get_info<sycl::info::device::driver_version>().c_str());
110+
global_mem_size, device.get_info<sycl::info::device::driver_version>().c_str(), xmx.c_str());
117111
}
118112

119113
void ggml_backend_sycl_print_sycl_devices() {
@@ -124,16 +118,16 @@ void ggml_backend_sycl_print_sycl_devices() {
124118

125119
GGML_LOG_INFO(
126120
"| | | | "
127-
" |Max | |Max |Global | |\n");
121+
" |Max | |Max |Global | | XMX |\n");
128122
GGML_LOG_INFO(
129123
"| | | | "
130-
" |compute|Max work|sub |mem | |\n");
124+
" |compute|Max work|sub |mem | | or |\n");
131125
GGML_LOG_INFO(
132126
"|ID| Device Type| "
133-
"Name|Version|units |group |group|size | Driver version|\n");
127+
"Name|Version|units |group |group|size | Driver version| Tensor Cores |\n");
134128
GGML_LOG_INFO(
135129
"|--|-------------------|---------------------------------------|------"
136-
"-|-------|--------|-----|-------|---------------------|\n");
130+
"-|-------|--------|-----|-------|---------------------|--------------|\n");
137131

138132
for (int id = 0; id < device_count; ++id) {
139133
sycl::device device = dpct::dev_mgr::instance().get_device(id);
@@ -164,14 +158,18 @@ static void ggml_check_sycl() try {
164158
static bool initialized = false;
165159

166160
if (!initialized) {
167-
GGML_LOG_INFO("[SYCL] call ggml_check_sycl\n");
161+
GGML_SYCL_DEBUG("[SYCL] call ggml_check_sycl\n");
168162
g_ggml_sycl_debug = get_sycl_env("GGML_SYCL_DEBUG", 0);
169-
GGML_LOG_INFO("%s: GGML_SYCL_DEBUG: %d\n", __func__, g_ggml_sycl_debug);
170-
163+
GGML_LOG_INFO("GGML_SYCL_DEBUG: %d\n", g_ggml_sycl_debug);
164+
#if defined(GGML_SYCL_FORCE_MMQ)
165+
GGML_LOG_INFO("GGML_SYCL_FORCE_MMQ: yes\n");
166+
#else
167+
GGML_LOG_INFO("GGML_SYCL_FORCE_MMQ: no\n");
168+
#endif
171169
#if defined(GGML_SYCL_F16)
172-
GGML_LOG_INFO("%s: GGML_SYCL_F16: yes\n", __func__);
170+
GGML_LOG_INFO("GGML_SYCL_F16: yes\n");
173171
#else
174-
GGML_LOG_INFO("%s: GGML_SYCL_F16: no\n", __func__);
172+
GGML_LOG_INFO("GGML_SYCL_F16: no\n");
175173
#endif
176174

177175
/* NOT REMOVE, keep it for next optimize for XMX.

0 commit comments

Comments
 (0)