Archived
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves every shipped container - Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime - /v1/messages works with Claude Code as it ships (gearwave00001) - a long agent conversation keeps its cached history when the client rewrites its last turn (manueloverride) - a stream's first event goes out with the first token, so llama-benchy measures prefill right - opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42) - four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b) - NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA adapters (baKon) - many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool arguments and the CPU's vision and audio encoders - plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
67 lines
2.5 KiB
C++
67 lines
2.5 KiB
C++
/* directio.h -- the file tier's reader (spec §5.4): O_DIRECT reads into pinned buffers, used by
|
|
* the weight tier and the KV tier.
|
|
*
|
|
* The page cache is avoided for two reasons:
|
|
* - it is a second copy of every byte already headed for a pinned buffer;
|
|
* - it evicts. A large tier read through the page cache throws out the mapped `.rad` pool's
|
|
* pages, which shows up later as an untraceable decode stall.
|
|
*
|
|
* O_DIRECT requires the file offset, transfer length and buffer address to be block-aligned.
|
|
* rad_dev_alloc memory is (host.cpp) and .rad pads movement units to RAD_ALIGN_UNIT
|
|
* (rad_format.h), so every mover read takes the unbounced path. The bounce is for other callers.
|
|
*/
|
|
#pragma once
|
|
#include <cstdint>
|
|
|
|
namespace rad {
|
|
|
|
enum {
|
|
RAD_DIO_READ = 1,
|
|
RAD_DIO_WRITE = 2, /* implies read: a partial block is a read-modify-write */
|
|
RAD_DIO_CREATE = 4,
|
|
RAD_DIO_TRUNC = 8,
|
|
|
|
/* Open buffered when the filesystem refuses O_DIRECT, instead of failing. Off by default: a
|
|
* silent buffered fallback makes the weight tier ~3x slower and is invisible in a profile.
|
|
* For tests, which run on whatever /tmp is. */
|
|
RAD_DIO_ALLOW_BUFFERED = 16,
|
|
};
|
|
|
|
class DirectFile {
|
|
public:
|
|
DirectFile() = default;
|
|
~DirectFile();
|
|
DirectFile(const DirectFile&) = delete;
|
|
DirectFile& operator=(const DirectFile&) = delete;
|
|
|
|
/* RAD_OK, or a negative RAD_E_*. `flags` is the RAD_DIO_* set above. */
|
|
int open(const char* path, int flags);
|
|
void close();
|
|
|
|
bool is_open() const { return fd_ >= 0; }
|
|
/* Whether the open actually got O_DIRECT. False only under RAD_DIO_ALLOW_BUFFERED. */
|
|
bool direct() const { return direct_; }
|
|
int fd() const { return fd_; }
|
|
int64_t size() const;
|
|
|
|
/* Exact reads and writes: a short transfer is RAD_E_IO, never a partial success, so callers
|
|
* need no byte-count check. */
|
|
int read_at(void* dst, int64_t off, int64_t bytes);
|
|
int write_at(const void* src, int64_t off, int64_t bytes);
|
|
|
|
/* The alignment every fast-path extent must satisfy. A fixed 4096 rather than the device's
|
|
* logical block size (often 512, see STATX_DIOALIGN): it covers every real requirement, equals
|
|
* RAD_ALIGN_UNIT, and keeps behaviour independent of the filesystem. */
|
|
static constexpr int64_t alignment() { return 4096; }
|
|
|
|
private:
|
|
int bounce_ready();
|
|
|
|
int fd_ = -1;
|
|
bool direct_ = false;
|
|
uint8_t* bounce_ = nullptr;
|
|
int64_t bounce_bytes_ = 0;
|
|
};
|
|
|
|
} /* namespace rad */
|