[GH-ISSUE #1473] STRATA_SYCL_SPIN_MAX default: a JIT build of the B70 gets the A-series bound and loses 46-67% of decode #589

Closed
opened 2026-11-04 01:44:18 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @demetree on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1473

The 2,000,000 spin bound costs 46-67% of decode on a JIT build of the B70

0.1.40.3 made the device's spin bound on host flags a build option (STRATA_SYCL_SPIN_MAX) and defaulted it to
20,000 only for a bmg AOT build - 2,000,000 for everything else, on the grounds that the A-series JIT build
needs it, where the GPU genuinely waits on the host's slow per-layer CPU expert work.

A B70 built without AOT is not a bmg AOT build, so it inherits the A-series value. But the two cases are
opposite: on the A-series the wait ends when the CPU expert work is done; on a card whose host handshake is not
visible during a window, the wait is expected to run out and give up, and every extra read is time spent on nothing.
STRATA_VERIFY_NO_HOST=1 exists for exactly that case - the port's own note is that a kernel's writes to
host-mapped memory are "not reliably visible while the graph runs".

Same binary, one -DSTRATA_SYCL_SPIN_MAX apart, Arc Pro B70, OpenCL, Coder IQ1_M, --spec 4 --mtp, 128 greedy
tokens, medians of two interleaved runs:

context -DSTRATA_SYCL_SPIN_MAX=2000000 =20000
3-token prompt 40.6 tok/s 59.0 +46%
2,048-token prompt 25.6 tok/s 42.9 +67%

The loss grows with the context, which is what more expired waits looks like. With 20,000 the same engine decodes
faster than 0.1.40.2 did (42.9 against 40.8 at the 2,048-token context; 59.0 against 51.0 short), so the whole of
the regression I reported earlier is this default.

What would help

Keying the carve-out on the card (bmg) rather than on STRATA_SYCL_AOT MATCHES "^bmg" would cover the JIT build of
the same card, which is what docs/INTEL.md tells people to avoid only for speed (the AOT build is the recommendation
because of JIT time, not because the JIT build is wrong). Alternatively the bound could follow the property it exists
for - whether this build's host handshake is visible during a window - which on the OpenCL backend it is not, on any
card.

No behaviour change either way in my measurements: quantize_act_parity and sampler_parity are 0 failures at both
bounds, and through the API 2+2 answers 4.

Originally created by @demetree on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1473 ### The 2,000,000 spin bound costs 46-67% of decode on a JIT build of the B70 0.1.40.3 made the device's spin bound on host flags a build option (`STRATA_SYCL_SPIN_MAX`) and defaulted it to 20,000 only for a `bmg` **AOT** build - 2,000,000 for everything else, on the grounds that the A-series JIT build needs it, where the GPU genuinely waits on the host's slow per-layer CPU expert work. A B70 built **without** AOT is not a `bmg` AOT build, so it inherits the A-series value. But the two cases are opposite: on the A-series the wait *ends* when the CPU expert work is done; on a card whose host handshake is not visible during a window, the wait is expected to run out and give up, and every extra read is time spent on nothing. `STRATA_VERIFY_NO_HOST=1` exists for exactly that case - the port's own note is that a kernel's writes to host-mapped memory are "not reliably visible while the graph runs". Same binary, one `-DSTRATA_SYCL_SPIN_MAX` apart, Arc Pro B70, OpenCL, Coder IQ1_M, `--spec 4 --mtp`, 128 greedy tokens, medians of two interleaved runs: | context | `-DSTRATA_SYCL_SPIN_MAX=2000000` | `=20000` | | |---|---|---|---| | 3-token prompt | 40.6 tok/s | **59.0** | +46% | | 2,048-token prompt | 25.6 tok/s | **42.9** | +67% | The loss grows with the context, which is what more expired waits looks like. With 20,000 the same engine decodes *faster* than 0.1.40.2 did (42.9 against 40.8 at the 2,048-token context; 59.0 against 51.0 short), so the whole of the regression I reported earlier is this default. ### What would help Keying the carve-out on the card (`bmg`) rather than on `STRATA_SYCL_AOT MATCHES "^bmg"` would cover the JIT build of the same card, which is what `docs/INTEL.md` tells people to avoid only for speed (the AOT build is the recommendation because of JIT time, not because the JIT build is wrong). Alternatively the bound could follow the property it exists for - whether this build's host handshake is visible during a window - which on the OpenCL backend it is not, on any card. No behaviour change either way in my measurements: `quantize_act_parity` and `sampler_parity` are 0 failures at both bounds, and through the API 2+2 answers 4.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

Correction: it is not the card, and it is not one-directional

I dug further and the first version of this report was half right in a way that matters. Keying the carve-out on the
card would not fix it, because the bound is worth about 3x in either direction depending on how the engine is
configured, and what it actually decides is whether speculation works at all - not how long a window costs.

A window that spins on a host flag it cannot see runs out and goes on without what it was waiting for. That is
harmless when what it wanted was a plan it already has (the window's waits, with the MTP drafter on, since the MTP
record path has already published it) and ruinous when it was a draft (the suffix drafter's own waits, without
--mtp). Same build, one -DSTRATA_SYCL_SPIN_MAX apart, Coder IQ1_M with --ple-gguf, 256 greedy tokens after a
2,048-token prompt, medians of two interleaved runs, acceptance from the engine's own speculation line:

mode 2,000,000 20,000
--spec 4 --mtp tok/s 26.2 45.4
tokens per round 2.28 (73 of 126 drafts accepted) 4.19 (99 of 99)
--spec 2 tok/s 68.8 21.8
tokens per round 2.17 (2 suffix windows drafted) 1.03 (0 drafted)
--spec 4, no --mtp tok/s 69.7 18.9

So 20,000 is both faster and better with --mtp - the drafts come back right - and 3.7x slower without it, because
the suffix drafter produces nothing at all inside that bound and every round then verifies a single token. Nothing about
that failure is visible in the answer: 2+2 is still 4.

What I think this points at

A single build constant is asked to cover two kinds of wait, and they want opposite things:

  • the window's per-layer waits are expected to expire on a backend whose handshake is not visible during a window,
    and every read past the moment they give up is time spent on nothing (worth ~3x on the --mtp path);
  • the drafting waits are the opposite: they have to complete, and running out leaves the drafter empty-handed
    (worth ~3x on the --spec-only path).

Bounding them separately would take both, and would also let the bound follow the property it exists for instead of a
card name or an AOT flag - which is what the 20,000 and 2,000,000 values are each standing in for today. If the two
kinds were told apart (a drafting wait that runs out being a hard error rather than a silent "carry on"), the default
would not have to guess.

For my port I have taken the 20,000 default on Windows with the MTP drafter (the configuration setup writes) and a
stderr warning in the run wrapper when the engine is launched without --mtp, pointing at
-DSTRATA_SYCL_SPIN_MAX=2000000. Numbers and code: PR #1390.

Parity is unchanged at both bounds: quantize_act_parity and sampler_parity are 0 failures. Through the API on the
--spec 4 --mtp configuration, 2+2 answers 4 and a Fibonacci request returns a correct function.

<!-- gh-comment-id:6050246387 --> @demetree commented on GitHub (Oct 8, 2026): ### Correction: it is not the card, and it is not one-directional I dug further and the first version of this report was half right in a way that matters. Keying the carve-out on the card would not fix it, because the bound is worth about **3x in either direction** depending on how the engine is configured, and what it actually decides is whether *speculation works at all* - not how long a window costs. A window that spins on a host flag it cannot see runs out and goes on without what it was waiting for. That is harmless when what it wanted was a plan it already has (the window's waits, with the MTP drafter on, since the MTP record path has already published it) and ruinous when it was a draft (the suffix drafter's own waits, without `--mtp`). Same build, one `-DSTRATA_SYCL_SPIN_MAX` apart, Coder IQ1_M with `--ple-gguf`, 256 greedy tokens after a 2,048-token prompt, medians of two interleaved runs, acceptance from the engine's own speculation line: | mode | | 2,000,000 | 20,000 | |---|---|---|---| | `--spec 4 --mtp` | tok/s | 26.2 | **45.4** | | | tokens per round | 2.28 (73 of 126 drafts accepted) | **4.19 (99 of 99)** | | `--spec 2` | tok/s | **68.8** | 21.8 | | | tokens per round | **2.17** (2 suffix windows drafted) | 1.03 (**0 drafted**) | | `--spec 4`, no `--mtp` | tok/s | **69.7** | 18.9 | So 20,000 is both faster *and* better with `--mtp` - the drafts come back right - and 3.7x slower without it, because the suffix drafter produces nothing at all inside that bound and every round then verifies a single token. Nothing about that failure is visible in the answer: 2+2 is still 4. ### What I think this points at A single build constant is asked to cover two kinds of wait, and they want opposite things: - the **window's** per-layer waits are expected to expire on a backend whose handshake is not visible during a window, and every read past the moment they give up is time spent on nothing (worth ~3x on the `--mtp` path); - the **drafting** waits are the opposite: they have to *complete*, and running out leaves the drafter empty-handed (worth ~3x on the `--spec`-only path). Bounding them separately would take both, and would also let the bound follow the property it exists for instead of a card name or an AOT flag - which is what the 20,000 and 2,000,000 values are each standing in for today. If the two kinds were told apart (a drafting wait that runs out being a hard error rather than a silent "carry on"), the default would not have to guess. For my port I have taken the 20,000 default on Windows with the MTP drafter (the configuration setup writes) and a stderr warning in the run wrapper when the engine is launched without `--mtp`, pointing at `-DSTRATA_SYCL_SPIN_MAX=2000000`. Numbers and code: PR #1390. Parity is unchanged at both bounds: `quantize_act_parity` and `sampler_parity` are 0 failures. Through the API on the `--spec 4 --mtp` configuration, 2+2 answers 4 and a Fibonacci request returns a correct function.
Author
Owner

@Niko1221 commented on GitHub (Oct 10, 2026):

Thank you, the measurements (and the correction to the first version) were the missing piece. What v0.1.42 does:

  • On Linux an xe card keeps the 20,000-read bound in every mode (unchanged from 0.1.41). When there is no sysfs driver name (Windows / OpenCL) the engine now recognises a Battlemage card from the device itself: the SYCL architecture (bmg-g21/g31), then the PCI id in the name (Intel(R) Graphics [0xe223]), then the marketing name. That card gets 20,000 reads as well. We checked the detection on a B70 under both the Level Zero and the OpenCL backend; the Windows case itself we cannot run.
  • Your second finding, that a run that drafts without --mtp needs the long bound (68.8 vs 21.8 tok/s at --spec 2), is applied as well: with --spec >= 2 and no --mtp the bound stays 2,000,000 on such a card.

Could you run your two configurations (--spec 4 --mtp and --spec 2) on a v0.1.42 build on Windows with no -DSTRATA_SYCL_SPIN_MAX and tell us whether each gets the better bound? STRATA_SPIN_MAX=<reads> still overrides both.

<!-- gh-comment-id:6099594619 --> @Niko1221 commented on GitHub (Oct 10, 2026): Thank you, the measurements (and the correction to the first version) were the missing piece. What v0.1.42 does: - On Linux an xe card keeps the 20,000-read bound in every mode (unchanged from 0.1.41). When there is no sysfs driver name (Windows / OpenCL) the engine now recognises a Battlemage card from the device itself: the SYCL architecture (bmg-g21/g31), then the PCI id in the name (`Intel(R) Graphics [0xe223]`), then the marketing name. That card gets 20,000 reads as well. We checked the detection on a B70 under both the Level Zero and the OpenCL backend; the Windows case itself we cannot run. - Your second finding, that a run that drafts without `--mtp` needs the long bound (68.8 vs 21.8 tok/s at `--spec 2`), is applied as well: with `--spec` >= 2 and no `--mtp` the bound stays 2,000,000 on such a card. Could you run your two configurations (`--spec 4 --mtp` and `--spec 2`) on a v0.1.42 build on Windows with no `-DSTRATA_SYCL_SPIN_MAX` and tell us whether each gets the better bound? `STRATA_SPIN_MAX=<reads>` still overrides both.
Author
Owner

@Niko1221 commented on GitHub (Oct 13, 2026):

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6156102675 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#589
No description provided.