[Engine] SYCL: the grouped-expert bench reports a device-side launch failure instead of silently timing nothing

The bench's queue is created with an exception handler, which swallows a failing kernel: the timing then reads
"0.3 us per group of 10 experts" because nothing ran, and the bit-for-bit comparison passes trivially (both
buffers stay at the 0xff fill).  Every wait now goes through wait_and_throw() and prints the what() of a failure.

Verified on the Arc box: a run with real geometry prints dn=10 and non-zero outputs, so the kernel does run; the
per-mode timing of a single small group is still under one expert's memory traffic and needs the mode/phase
semantics checked before its GB/s numbers are quoted.
This commit is contained in:
Niko1221 committed 2026-10-29 12:45:34 +01:00
1 parent da3df90eb8
commit d56565ce39
1 file changed
+16 -2
+16 -2
View File
@@ -49,6 +49,18 @@ int main(int argc, char** argv) {
int failures = 0;
dpct::queue_ptr s;
s = dpct::get_current_device().create_queue(true);
// SYCL port: the queue carries an exception handler, which would swallow a failing launch and leave the timing
// at "the kernel did nothing" (0.3 us for a group of experts). Every wait goes through this, so a device-side
// error is printed instead of silently producing an empty measurement.
auto sync = [&](const char* what) {
try {
s->wait_and_throw();
return true;
} catch (std::exception const& e) {
std::printf("%s: %s\n", what, e.what());
return false;
}
};
for (int l : layers) {
const strata::TensorInfo* t[3] = {};
const char* roles[3] = {"gate", "up", "down"};
@@ -120,11 +132,13 @@ int main(int argc, char** argv) {
std::vector<float> ref((size_t) NE * H), got((size_t) NE * H);
s->memset(dout, 0xff, got.size() * 4).wait();
run(mref, 0);
if (!sync("reference window")) return 1;
s->memcpy(ref.data(), dout, ref.size() * 4).wait();
s->memset(dout, 0xff, got.size() * 4).wait();
run(mode, 0);
if (!sync("mode window")) return 1;
s->memcpy(got.data(), dout, got.size() * 4).wait();
s->wait();
size_t ndiff = 0;
double worst = 0;
for (size_t i = 0; i < ref.size(); ++i)
@@ -137,7 +151,7 @@ int main(int argc, char** argv) {
s->wait();
const auto t0 = std::chrono::steady_clock::now();
for (int i = 0; i < iters; ++i) run(m, phase);
s->wait();
sync("timing loop");
const double ms =
std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0).count();
return ms / iters;