Merge upstream main (v1.12 -> v1.15.1, 408 commits) into the SYCL port

Conflicts from the old m2xfp branch take upstream's version. Two libxe2 fixes the merge needs:
- rad_plugin_abi_layout: the plugin now exports the ABI layout hash the loader checks.
- gemm_nt_q_w4a16: upstream 492d33c sends bf16 activations to the w4a16 GEMM (the separate cast
  is gone); the fast kernel took only f16, so every call fell back to the exact path (decode
  ~2.5 tok/s). A bf16 activation is narrowed to f16 (round to nearest even) into a workspace first,
  the dropped cast bit for bit; decode back to ~57 tok/s on one request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-11-02 00:25:57 +01:00
commit 7580ec3d17
937 files changed
+285776 -8914

No files matched your search

+41 -5
View File
@@ -104,26 +104,47 @@ extern "C" void* rad_link_gate(RadStream s);
* A ride is a signal completed by the next dispatch on a stream, instead of a separate barrier
* packet. That dispatch keeps its ordering bit, so the signal covers everything before it.
* rad_ride_wait puts a barrier waiting on it onto another stream and recycles the signal behind
* that barrier. A ride polled by the DMA engine is returned with rad_ride_release once nothing can
* poll it: immediately (`after` null) when the polling list has finished, else once `after` is
* `packets` dispatches further on.
* that barrier. A ride handed to rad_xp_list as its mark is returned with rad_ride_release once
* the caller is done with it, `after` null; the backend keeps it out of reuse until the list's
* engine is past its poll. One never handed to a list (a dropped request's) is returned with
* `after` and `packets` reaching past the dispatch it rides on: the signal is reused only once
* `after` has consumed `packets` more packets.
*
* rad_xp_list gives the card's prefetch DMA queue a list: wait for `mark` (a ride, or null), copy
* the `n` ranges, then write `done_val` to `done` (pinned host memory, or null). rad_xp_behind
* counts lists handed over and not yet finished. The prefetch ring is uncached device memory
* (rad_dev_alloc_uncached): the engine writes it and kernels read it, so no cache may hold a
* slot's previous contents. */
/* An event a DMA list completes instead of a dispatch. `*word` is its completion word, for
* rad_xp_list to write 0 to as the list's `done`; the caller arms it with a 1 in stream order (the
* weight table's patch dispatch). `rad_event_wait(s, ev)` then holds `s` on the device until the
* copy has landed. The caller waits for the previous copy before arming the next, so an older 0
* cannot release a later wait. RAD_E_STATE while a tape records: the caller re-runs it with the
* tape paused (core/kvstream/stage.cpp). */
extern "C" int rad_event_dma(RadEvent ev, RadStream s, uint32_t** word);
extern "C" int rad_xp_supported(int device);
extern "C" int rad_xp_stream_create(RadStream* out);
extern "C" int rad_ride(RadStream s, void** token);
extern "C" int rad_ride_wait(RadStream s, void* token);
extern "C" void rad_ride_release(void* token, RadStream after, int64_t packets);
/* `flags` RAD_XP_NO_YIELD: the list does not yield the link to a hold by a stream of this card. A
* copy the compute stream waits on must set it, since the hold's release is behind that wait. */
#define RAD_XP_NO_YIELD 1u
extern "C" int rad_xp_list(int device, void* mark, int n, const uint64_t* src, const uint64_t* dst,
const uint64_t* bytes, uint32_t* done, uint32_t done_val);
const uint64_t* bytes, uint32_t* done, uint32_t done_val,
unsigned flags);
extern "C" int64_t rad_xp_behind(int device);
extern "C" void* rad_dev_alloc_uncached(int64_t bytes);
extern "C" void rad_dev_free_uncached(void* p);
/* [foff, foff + bytes) of the open file `fd`, mapped MAP_SHARED and pinned for every card as a
* RAD_MEM_HOST_MAPPED allocation is: one range at the same address on host and cards. For a table
* that engines on separate cards share through a tmpfs file (format/table_share.h). `foff` is a
* multiple of 2 MiB and the file holds the whole range. Freed with rad_dev_free(p,
* RAD_MEM_HOST_MAPPED), which unpins and unmaps and leaves the file alone. Null with the reason in
* rad_dev_last_error() on a backend without it or a failure. */
extern "C" void* rad_dev_map_file(int fd, int64_t foff, int64_t bytes);
/* A gate on a stream: the stream stops at the point rad_stream_gate enqueues and goes on once the
* host calls rad_gate_open. Everything enqueued behind the gate meanwhile is then ready at once, so
* the device runs it back to back however long the host took to submit it. For timing a batch of
@@ -316,7 +337,7 @@ struct DeviceBackend {
int (*ride_wait)(RadStream s, void* token);
void (*ride_release)(void* token, RadStream after, int64_t packets);
int (*xp_list)(int device, void* mark, int n, const uint64_t* src, const uint64_t* dst,
const uint64_t* bytes, uint32_t* done, uint32_t done_val);
const uint64_t* bytes, uint32_t* done, uint32_t done_val, unsigned flags);
int64_t (*xp_behind)(int device);
void* (*alloc_uncached)(int64_t bytes);
void (*free_uncached)(void* p);
@@ -325,6 +346,15 @@ struct DeviceBackend {
int (*stream_gate)(RadStream s, void** gate);
int (*gate_open)(void* gate);
int64_t (*gate_room)(RadStream s);
/* ---- rad_event_dma; null on a backend with no DMA queue. */
int (*event_dma)(RadEvent e, RadStream s, uint32_t** word);
/* ---- see rad_dev_map_file. Null on a backend with no pinned host memory to map a file into. */
void* (*map_file)(int fd, int64_t foff, int64_t bytes);
/* ---- see dev_stuck_ms. Null on a backend that cannot tell. */
int64_t (*stuck_ms)(void);
};
@@ -363,6 +393,12 @@ std::string dev_runtime_version();
/* The current backend's DeviceBackend::dma_lane, "" where it has none. */
std::string dev_dma_lane(int device);
/* How long the device has been stuck, in ms, or 0: since the last moment anything advanced, once a
* host wait has seen nothing advance for its stall period and named the stuck packet (the queue
* dump), or since a queue faulted. Anything advancing again clears it. 0 where the backend cannot
* tell. */
int64_t dev_stuck_ms();
/* Longest run of dispatches a played tape leaves unordered. Of any kTapeOverlapRun + 1
* consecutive packets on a queue one carries the barrier bit, so a launched packet still proves
* that everything more than that many packets earlier has completed. Argument slots and tape