diff --git a/core/diag/diag.h b/core/diag/diag.h index a02e2824..4f2bb217 100644 --- a/core/diag/diag.h +++ b/core/diag/diag.h @@ -109,6 +109,7 @@ struct HostFacts { std::string io_uring; /* available | refused (why) | unknown */ std::string cpu_governor, cpu_epp, cpu_driver; std::string runtime; /* the device runtime's version, "" for none */ + std::string media; /* "libavformat " / "absent (built without libav*)" */ }; struct Facts { diff --git a/core/diag/report.cpp b/core/diag/report.cpp index 189b7678..a64661bc 100644 --- a/core/diag/report.cpp +++ b/core/diag/report.cpp @@ -89,6 +89,8 @@ std::string host_lines(const HostFacts& h, const RunFacts& r) { o += fmt(" runtime %s | backend %s\n", h.runtime.empty() ? "no device runtime" : h.runtime.c_str(), r.host_backend ? "host (CPU)" : "device"); + if (!h.media.empty()) + o += fmt(" media decoders %s\n", h.media.c_str()); return o; } @@ -224,6 +226,7 @@ std::string to_json(const std::vector& config, const std::vector @@ -37,6 +38,7 @@ diag::Facts Engine::hardware_facts(bool serving) const { if (r->device == id.device) mine.push_back(id.bdf); diag::Facts f = diag::collect("", serving ? &mine : nullptr); f.host.runtime = runtime_version_; + f.host.media = mm::decoder_version(); if (probed_) { f.host.memlock_soft = memlock_soft_; f.host.io_uring = io_uring_; diff --git a/core/mm/media.cpp b/core/mm/media.cpp index 8eb1e048..586a2173 100644 --- a/core/mm/media.cpp +++ b/core/mm/media.cpp @@ -5,6 +5,7 @@ #include "rad_internal.h" #include +#include #include #ifdef RAD_HAVE_FFMPEG @@ -26,6 +27,8 @@ namespace mm { bool decoder_available() { return false; } +std::string decoder_version() { return "absent (built without libav*)"; } + static int no_decoder(std::string* why) { if (why) *why = "this build has no media decoder: it was configured without libavformat / " "libavcodec / libswscale (RAD_WITH_FFMPEG)"; @@ -57,6 +60,14 @@ int decode_audio(const uint8_t*, size_t, int32_t, int64_t, std::vector*, bool decoder_available() { return true; } +std::string decoder_version() { + const unsigned v = avformat_version(); + char b[48]; + std::snprintf(b, sizeof(b), "libavformat %u.%u.%u", AV_VERSION_MAJOR(v), AV_VERSION_MINOR(v), + AV_VERSION_MICRO(v)); + return b; +} + namespace { /* The only demuxers a request may reach. A format that can name another file (a playlist, a diff --git a/core/mm/media.h b/core/mm/media.h index 4920bc47..f887b79e 100644 --- a/core/mm/media.h +++ b/core/mm/media.h @@ -36,6 +36,11 @@ struct FrameRGBA { /* Whether this build has a decoder. */ bool decoder_available(); +/* "libavformat " when the decoder is built in, "absent (built without libav*)" + * when it is not: one string for the startup report and /diagnostics, so a media 500 can be + * read off the report instead of bisected. */ +std::string decoder_version(); + /* The first frame of an image (or of anything with a video stream). Refuses a source over * `max_pixels`, which bounds what a request can make the server allocate before any resize. */ int decode_image(const uint8_t* data, size_t n, int64_t max_pixels, Frame* out, std::string* why); diff --git a/docs/GUIDE.md b/docs/GUIDE.md index 3eaa62fc..a0b97a18 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -52,6 +52,7 @@ driver. [`DOCKER.md`](DOCKER.md) covers it, with compose files per model. | Optional | ROCm with `hipcc`, for AMD device kernels; without it you get the host backend. Set `ROCM_PATH` if ROCm is not at `/opt/rocm` | | With a card | Resizable BAR on (Above 4G Decoding and Resizable BAR in the firmware setup). The host writes every dispatch's arguments into VRAM there. On a card whose BAR is smaller than its VRAM they stay in pinned host memory and every dispatch reads them over the link: on R9700s, Qwen3.8-27B fp8 decode steps take 0.4-1.8% longer at `--tp 1` and 2 than with the arguments in VRAM. Peer access needs the large BAR too, so at `--tp 2` and above such a card takes the collectives through host memory (§4.7) | | Optional | OpenMP, used by the host kernel libraries if present | +| Optional | `libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-dev` (ffmpeg 6+), for image, video and audio input. The probe is `RAD_WITH_FFMPEG` (`ON` fatal, `OFF` off, default `AUTO`): built without them the engine boots normal, serves text, and refuses every image/video/audio part with HTTP 500 — the configure log is the only warning (`radiance: no libavformat ...`). `GET /diagnostics` shows `media decoders` | | Optional | `clang++` (or ROCm's), for `tests/r4d_emu` when the C++ compiler is g++; CMake 3.25+ for `CMakePresets.json` | | Shell harnesses | `curl` and `jq` |