Files
Strata/engine/sycl/include/strata/copy_queue.hpp
T
Niko1221 4058aa782b Layout move for 0.2.16: the top level becomes app/, engine/, terminal/, docs/, tools/ and .github/
Made by tools/layout/move_0216.py (the commit before this one) on db8e0be9c, the final code head of 0.2.16:
- 75 git mv (renames, so `git log --follow` and blame keep working; packaging/acceptance_matrix.md shows as delete + add because its links
  changed too) and 3 removals: SETUP.bat, UPDATE.bat and update.sh (setup.py --update pulls the code now);
- 1,425 path edits in 307 files: root-relative paths in CI, Docker, .gitignore and the release scripts; Markdown links; Python and
  Node joins from a root that moved with its folder; explicit edits for code that computes a root or names a moved path; tables of
  repository paths inside tests.

engine/ holds what CMake builds (src, include, cmake, metal, sycl, spark, third_party, the C++ tests and benches). app/ is the desktop
app and its host (was apps/). terminal/ is the Terminal in the layout of the installed one (strata.py, setup.py, strata_cli,
strata_control, serve, bin, data, ref, crates, the Python tools and tests). docs/ has the documentation, docs/lang/ the translated
READMEs, docs/history and docs/bench-results. tools/ has the repository's own checks, packaging, docker, research and nix.
tests/core/test_tqp_ref.py is a pytest file and stays with the Python tests (terminal/tests/core/).
AGENTS.md, README.md, LICENSE, setup.sh and START-HERE.bat stay at the root.

No behaviour change: the same command lines, the same sources. For this head a replay of the script gave the same numbers and the path
scan (tools/layout/checks/path_scan.py) reports no hit; the suites and the builds run on this commit next.
2026-11-17 13:19:21 +01:00

28 lines
2.0 KiB
C++

// include/strata/copy_queue.hpp - SYCL port, 0.1.43: a queue on the GPU's dedicated copy (blitter) engine.
//
// WHY. With the Level Zero "v2" adapter (the default on Xe2 / Battlemage and newer), every SYCL queue, including a queue
// that only holds host-to-device copies, runs on the compute engine: a 2 MB expert copy (~80 us at 25 GB/s) blocks the
// kernels behind it for that long. A prompt chunk streams ~10,000 experts: ~0.8 s of the 3.8 s of a 4K prompt on an Arc
// Pro B70 is the compute engine waiting for its own copies (unitrace: every H2D copy sits on "L0 Compute Engine<0,0>"
// and none overlaps a kernel). The device does expose a copy-only queue group (zeDeviceGetCommandQueueGroupProperties:
// group 1, flags COPY, 1 queue); the v2 adapter just does not use it for in-order queues.
//
// WHAT. make_copy_engine_queue() creates an immediate command list on that group and wraps it with
// sycl::make_queue<ext_oneapi_level_zero>, so everything built on SYCL queues (memcpy, events, ext_oneapi_submit_barrier
// across queues) keeps working, only the engine changes. It returns nullptr (the caller keeps an ordinary in-order queue)
// when the backend is not Level Zero, the device has no copy-only group, the loader or the call fails, or
// STRATA_COPY_ENGINE=0 (default: on for a Battlemage card, which is where it was measured; =1 forces it on any Level Zero
// device, =0 off). Same bytes, same kernels: the tokens do not change.
#pragma once
#include <sycl/sycl.hpp>
namespace strata {
/// `what` names the first user in the one log line. One queue per process (an in-order queue, the same one for every
/// caller: copies are serial on one engine anyway); never freed, so a caller must not delete it.
sycl::queue* make_copy_engine_queue(const char* what);
/// true once a copy-engine queue has been made in this process
bool copy_engine_active();
/// true for the queue make_copy_engine_queue() returned: it runs copies and barriers only, no kernel (not even queue::fill)
bool is_copy_engine_queue(const sycl::queue* q);
} // namespace strata