Skip to content

Commit 1c1d4dc

Browse files
committed
vulkan: fix build for GGML_VULKAN_RUN_TESTS, add TFLOPS to logging
1 parent fbac47b commit 1c1d4dc

File tree

2 files changed

+102
-7
lines changed

2 files changed

+102
-7
lines changed

AUTHORS

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,91 @@
1-
# date: Tue Apr 9 20:16:51 EEST 2024
1+
# date: Thu Sep 26 09:19:50 CDT 2024
22
# this file is auto-generated by scripts/gen-authors.sh
33

44
5+
56
67
Abhilash Majumder <[email protected]>
78
Adam Tazi <[email protected]>
89
AidanBeltonS <[email protected]>
10+
AidanBeltonS <[email protected]>
11+
Akarshan Biswas <[email protected]>
12+
Albert Jin <[email protected]>
13+
Alberto Cabrera Pérez <[email protected]>
14+
Alberto Cabrera Pérez <[email protected]>
915
Alex Azarov <[email protected]>
16+
Alex O'Connell <[email protected]>
1017
Alex von Gluck IV <[email protected]>
1118
1219
AmirAli Mirian <[email protected]>
1320
Ananta Bastola <[email protected]>
21+
Andreas (Andi) Kunar <[email protected]>
1422
1523
1624
Ashraful Islam <[email protected]>
1725
1826
AsukaMinato <[email protected]>
1927
Avi Lumelsky <[email protected]>
2028
Bart Pelle <[email protected]>
29+
Ben Ashbaugh <[email protected]>
2130
Borislav Stanimirov <[email protected]>
2231
32+
Brad Murray <[email protected]>
33+
2334
Bryan Lozano <[email protected]>
2435
Carolinabanana <[email protected]>
36+
CarterLi999 <[email protected]>
2537
Cebtenzzre <[email protected]>
38+
39+
40+
Chris Elrod <[email protected]>
41+
Clint Herron <[email protected]>
42+
Conrad Kramer <[email protected]>
2643
2744
Cristiano Calcagno <[email protected]>
45+
2846
Dan Forbes <[email protected]>
2947
Daniel Bevenius <[email protected]>
48+
Daniel Ziegenberg <[email protected]>
49+
3050
Daulet Zhanguzin <[email protected]>
51+
52+
Dave Airlie <[email protected]>
53+
Dave Airlie <[email protected]>
3154
David Miller <[email protected]>
55+
DavidKorczynski <[email protected]>
3256
Davidson Francis <[email protected]>
57+
Dibakar Gope <[email protected]>
3358
Didzis Gosko <[email protected]>
3459
60+
3561
Dr. Tom Murphy VII Ph.D <[email protected]>
3662
Ebey Abraham <[email protected]>
3763
Eldar Yusupov <[email protected]>
64+
Emmanuel Durand <[email protected]>
3865
Engininja2 <[email protected]>
3966
Erik Scholz <[email protected]>
4067
Ettore Di Giacinto <[email protected]>
4168
4269
70+
Faisal Zaghloul <[email protected]>
4371
FantasyGmm <[email protected]>
4472
4573
Finn Voorhees <[email protected]>
4674
4775
George Hindle <[email protected]>
4876
Georgi Gerganov <[email protected]>
77+
4978
Guillaume Wenzek <[email protected]>
5079
Halalaluyafail3 <[email protected]>
5180
Herman Semenov <[email protected]>
5281
Hirochika Matsumoto <[email protected]>
82+
Hong Bo PENG <[email protected]>
5383
Hugo Rosenkranz-Costa <[email protected]>
5484
Hyunsung Lee <[email protected]>
5585
IGUILIZ Salah-Eddine <[email protected]>
5686
87+
Ikko Eltociear Ashimine <[email protected]>
88+
Ivan Filipov <[email protected]>
5789
Ivan Stepanov <[email protected]>
5890
Ivan Zdane <[email protected]>
5991
Jack Mousseau <[email protected]>
@@ -62,35 +94,53 @@ JacobLinCool <[email protected]>
6294
Jakob Frick <[email protected]>
6395
Jan Ploski <[email protected]>
6496
Jared Van Bortel <[email protected]>
97+
Jeff Bolz <[email protected]>
6598
Jeffrey Quesnelle <[email protected]>
99+
Jeroen Mostert <[email protected]>
66100
Jiahao Li <[email protected]>
67101
JidongZhang-THU <[email protected]>
68102
Jiří Podivín <[email protected]>
69103
104+
70105
Johannes Gäßler <[email protected]>
71106
John Balis <[email protected]>
72107
Josh Bleecher Snyder <[email protected]>
73108
109+
Justina Cho <[email protected]>
74110
Justine Tunney <[email protected]>
111+
Justine Tunney <[email protected]>
75112
113+
Kevin Gibbons <[email protected]>
76114
Konstantin Zhuravlyov <[email protected]>
77115
78116
LoganDark <[email protected]>
79117
LoganDark <[email protected]>
80118
LostRuins <[email protected]>
81119
Lukas Möller <[email protected]>
82120
M. Yusuf Sarıgöz <[email protected]>
121+
Mahesh Madhav <[email protected]>
83122
123+
Mark Zhuang <[email protected]>
124+
Markus Tavenrath <[email protected]>
125+
Masaya, Kato <[email protected]>
84126
Mathijs de Bruin <[email protected]>
127+
Matt Stephenson <[email protected]>
128+
Max Krasnyansky <[email protected]>
85129
Mayank Kumar Pal <[email protected]>
86130
Meng, Hengyu <[email protected]>
131+
Mengqing Cao <[email protected]>
87132
Metal Whale <[email protected]>
88133
Michael Klimenko <[email protected]>
89134
Michael Podvitskiy <[email protected]>
90135
Michael Verrilli <[email protected]>
136+
Molly Sophia <[email protected]>
137+
138+
Neo Zhang <[email protected]>
91139
Neo Zhang Jianyu <[email protected]>
92140
Neuman Vong <[email protected]>
93141
142+
Nicholai Tukanov <[email protected]>
143+
Nico Bosshard <[email protected]>
94144
Nouamane Tazi <[email protected]>
95145
Olivier Chafik <[email protected]>
96146
Olivier Chafik <[email protected]>
@@ -101,6 +151,9 @@ Paul Tsochantaris <[email protected]>
101151
102152
Pierre Alexandre SCHEMBRI <[email protected]>
103153
154+
Przemysław Pawełczyk <[email protected]>
155+
156+
104157
Radoslav Gerganov <[email protected]>
105158
Radosław Gryta <[email protected]>
106159
Ravindra Marella <[email protected]>
@@ -109,15 +162,20 @@ Reinforce-II <[email protected]>
109162
Reza Rezvan <[email protected]>
110163
111164
RiverZhou <[email protected]>
165+
166+
Rotem Dan <[email protected]>
112167
Ryan Hitchman <[email protected]>
168+
Salvatore Mesoraca <[email protected]>
113169
Sam Spilsbury <[email protected]>
114170
Sanchit Gandhi <[email protected]>
115171
Santtu Keskinen <[email protected]>
116172
Sergio López <[email protected]>
117173
118174
Siddharth Ramakrishnan <[email protected]>
175+
Sigbjørn Skjæret <[email protected]>
119176
Skyler Celestinian-Sterling <[email protected]>
120177
Slava Primenko <[email protected]>
178+
Srihari-mcw <[email protected]>
121179
Steward Garcia <[email protected]>
122180
Supreet Sethi <[email protected]>
123181
Takuya Takeuchi <[email protected]>
@@ -127,38 +185,61 @@ Tanmay Sachan <[email protected]>
127185
Timothy Cronin <[email protected]>
128186
Tom Bailey <[email protected]>
129187
Tom Jobbins <[email protected]>
188+
Tony Wasserka <[email protected]>
130189
Tyé singwa <[email protected]>
131190
UEXTM.com <[email protected]>
132191
WillCorticesAI <[email protected]>
192+
William Tambellini <[email protected]>
193+
William Tambellini <[email protected]>
133194
XiaotaoChen <[email protected]>
195+
Xuan Son Nguyen <[email protected]>
134196
Yavor Ivanov <[email protected]>
135197
YavorGIvanov <[email protected]>
198+
Yilong Guo <[email protected]>
199+
Yilong Guo <[email protected]>
200+
136201
apcameron <[email protected]>
137202
138203
ariez-xyz <[email protected]>
139204
automaticcat <[email protected]>
205+
140206
141207
bobqianic <[email protected]>
142208
143209
144210
compilade <[email protected]>
211+
compilade <[email protected]>
145212
146213
147214
148215
216+
149217
218+
goldwaving <[email protected]>
150219
hidenorly <[email protected]>
220+
hipudding <[email protected]>
151221
152222
jaeminSon <[email protected]>
223+
224+
153225
johnson442 <[email protected]>
226+
junchao-loongson <[email protected]>
227+
154228
155229
230+
231+
l3utterfly <[email protected]>
156232
157233
158234
235+
liuwei-git <[email protected]>
236+
luoyu-intel <[email protected]>
159237
238+
mashizora <[email protected]>
239+
160240
161241
242+
pengxin99 <[email protected]>
162243
pikalover6 <[email protected]>
163244
postmasters <[email protected]>
164245
@@ -168,8 +249,15 @@ snadampal <[email protected]>
168249
169250
170251
the-crypt-keeper <[email protected]>
252+
thewh1teagle <[email protected]>
253+
171254
255+
wangshuai09 <[email protected]>
256+
172257
yangyaofei <[email protected]>
258+
yuri@FreeBSD <yuri@FreeBSD>
259+
zhentaoyu <[email protected]>
173260
261+
174262
布客飞龙 <[email protected]>
175263
旺旺碎冰冰 <[email protected]>

src/ggml-vulkan.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5005,6 +5005,8 @@ static void ggml_vk_test_matmul(ggml_backend_vk_context * ctx, size_t m, size_t
50055005
}
50065006
}
50075007

5008+
ggml_pipeline_allocate_descriptor_sets(ctx->device);
5009+
50085010
vk_buffer d_X = ggml_vk_create_buffer_check(ctx->device, sizeof(X_TYPE) * x_ne, vk::MemoryPropertyFlagBits::eDeviceLocal);
50095011
vk_buffer d_Y = ggml_vk_create_buffer_check(ctx->device, sizeof(Y_TYPE) * y_ne, vk::MemoryPropertyFlagBits::eDeviceLocal);
50105012
vk_buffer d_D = ggml_vk_create_buffer_check(ctx->device, sizeof(float) * d_ne, vk::MemoryPropertyFlagBits::eDeviceLocal);
@@ -5121,7 +5123,9 @@ static void ggml_vk_test_matmul(ggml_backend_vk_context * ctx, size_t m, size_t
51215123

51225124
avg_err /= m * n;
51235125

5124-
std::cerr << "TEST " << shname << " m=" << m << " n=" << n << " k=" << k << " batch=" << batch << " split_k=" << split_k << " matmul " << time / num_it << "ms avg_err=" << avg_err << std::endl;
5126+
double tflops = 2.0*m*n*k*batch*num_it / (time / 1000.0) / (1000.0*1000.0*1000.0*1000.0);
5127+
5128+
std::cerr << "TEST " << shname << " m=" << m << " n=" << n << " k=" << k << " batch=" << batch << " split_k=" << split_k << " matmul " << time / num_it << "ms " << tflops << " TFLOPS avg_err=" << avg_err << std::endl;
51255129

51265130
if (avg_err > 0.1) {
51275131
std::cerr << "m = " << first_err_m << " n = " << first_err_n << " b = " << first_err_b << std::endl;
@@ -5243,12 +5247,14 @@ static void ggml_vk_test_dequant(ggml_backend_vk_context * ctx, size_t ne, ggml_
52435247

52445248
ggml_pipeline_request_descriptor_sets(ctx->device, p, 1);
52455249

5250+
ggml_pipeline_allocate_descriptor_sets(ctx->device);
5251+
52465252
ggml_vk_buffer_write(qx_buf, 0, qx, qx_sz);
52475253

52485254
vk_context subctx = ggml_vk_create_context(ctx, ctx->device->compute_queue);
52495255
ggml_vk_ctx_begin(ctx->device, subctx);
52505256
const std::vector<uint32_t> pc = { 1, (uint32_t)ne, (uint32_t)ne, (uint32_t)ne, (uint32_t)ne };
5251-
ggml_vk_dispatch_pipeline(ctx, subctx, p, { { qx_buf, 0, qx_sz }, { x_buf, 0, x_sz_f16 } }, pc.size() * sizeof(int), pc.data(), { (uint32_t)ne, 1, 1});
5257+
ggml_vk_dispatch_pipeline(ctx, subctx, p, { vk_subbuffer{ qx_buf, 0, qx_sz }, vk_subbuffer{ x_buf, 0, x_sz_f16 } }, pc.size() * sizeof(int), pc.data(), { (uint32_t)ne, 1, 1});
52525258
ggml_vk_ctx_end(subctx);
52535259

52545260
auto begin = std::chrono::high_resolution_clock::now();
@@ -5375,6 +5381,8 @@ static void ggml_vk_test_dequant_matmul(ggml_backend_vk_context * ctx, size_t m,
53755381
}
53765382
}
53775383

5384+
ggml_pipeline_allocate_descriptor_sets(ctx->device);
5385+
53785386
ggml_vk_buffer_write(qx_buf, 0, qx, qx_sz);
53795387
ggml_vk_buffer_write(y_buf, 0, y, y_sz);
53805388

@@ -5442,7 +5450,9 @@ static void ggml_vk_test_dequant_matmul(ggml_backend_vk_context * ctx, size_t m,
54425450

54435451
avg_err /= m * n;
54445452

5445-
std::cerr << "TEST MMQ " << shname << " m=" << m << " n=" << n << " k=" << k << " batch=" << batch << " split_k=" << split_k << " matmul " << time_ms / num_it << "ms avg_err=" << avg_err << std::endl;
5453+
double tflops = 2.0*m*n*k*batch*num_it / (time_ms / 1000.0) / (1000.0*1000.0*1000.0*1000.0);
5454+
5455+
std::cerr << "TEST MMQ " << shname << " m=" << m << " n=" << n << " k=" << k << " batch=" << batch << " split_k=" << split_k << " matmul " << time_ms / num_it << "ms " << tflops << " TFLOPS avg_err=" << avg_err << std::endl;
54465456

54475457
if (avg_err > 0.01 || std::isnan(avg_err)) {
54485458
std::cerr << "m = " << first_err_m << " n = " << first_err_n << " b = " << first_err_b << std::endl;
@@ -5494,9 +5504,6 @@ static ggml_tensor_extra_gpu * ggml_vk_tensor_create_extra(ggml_tensor * tensor)
54945504

54955505
static void ggml_vk_preallocate_buffers(ggml_backend_vk_context * ctx) {
54965506
#if defined(GGML_VULKAN_RUN_TESTS)
5497-
ctx->staging = ggml_vk_create_buffer_check(ctx->device, 100ul * 1024ul * 1024ul,
5498-
vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent | vk::MemoryPropertyFlagBits::eHostCached,
5499-
vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent);
55005507
ggml_vk_test_dequant(ctx, 7680, GGML_TYPE_F32);
55015508
ggml_vk_test_dequant(ctx, 7680, GGML_TYPE_Q4_0);
55025509
ggml_vk_test_dequant(ctx, 7680, GGML_TYPE_Q4_1);

0 commit comments

Comments
 (0)