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
89 lines
3.9 KiB
C++
89 lines
3.9 KiB
C++
/* aql.h -- declarations shared by the AQL backend's translation units.
|
|
*
|
|
* aql_code.cpp reads code objects (offload bundle, ELF note, msgpack metadata), aql.cpp owns the
|
|
* queues and all submission, and aql_blit.hip holds the backend's own copy and fill kernels.
|
|
* aql_blit.hip is compiled as HIP, so this header must not pull in HSA.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace rad {
|
|
namespace aql {
|
|
|
|
/* ------------------------------------------------------------------ code objects */
|
|
|
|
/* One kernel argument as laid out in the code object's metadata. `hidden` names the implicit
|
|
* arguments the compiler appends; explicit parameters map in order onto hipLaunchKernel's
|
|
* `kernelParams`. */
|
|
enum class Hidden : uint8_t {
|
|
None, /* an explicit parameter */
|
|
Pad, /* hidden_none: bytes the compiler reserved and reads nothing from */
|
|
BlockCountX, BlockCountY, BlockCountZ,
|
|
GroupSizeX, GroupSizeY, GroupSizeZ,
|
|
RemainderX, RemainderY, RemainderZ,
|
|
GlobalOffsetX, GlobalOffsetY, GlobalOffsetZ,
|
|
GridDims,
|
|
DynamicLds,
|
|
Unsupported, /* anything else: a kernel that wants it is refused by name */
|
|
};
|
|
|
|
struct KernelArg {
|
|
uint32_t offset = 0;
|
|
uint32_t size = 0;
|
|
Hidden hidden = Hidden::None;
|
|
std::string kind; /* the metadata's value_kind, for the refusal message */
|
|
};
|
|
|
|
struct KernelMeta {
|
|
std::string symbol; /* "<name>.kd" */
|
|
uint32_t kernarg_size = 0;
|
|
uint32_t group_size = 0; /* static LDS */
|
|
uint32_t private_size = 0; /* static scratch */
|
|
bool dynamic_stack = false;
|
|
std::vector<KernelArg> args;
|
|
};
|
|
|
|
/* Selects the card's code object from a clang offload bundle, or fails with `*why` naming what
|
|
* the bundle holds and what the card accepts. `isas` lists the card's accepted targets in the
|
|
* runtime's order of preference ("amdgcn-amd-amdhsa--gfx1036", then the family's
|
|
* "amdgcn-amd-amdhsa--gfx10-3-generic"), each with its modes ("gfx942:sramecc+:xnack-"). The
|
|
* bundle has no total length, so it is walked entry by entry. Compressed bundles are refused;
|
|
* nothing in this tree builds one. */
|
|
bool bundle_code_object(const void* bundle, const std::vector<std::string>& isas, const void** out,
|
|
size_t* out_size, std::string* why);
|
|
|
|
/* Every kernel described in an AMDGPU code object's metadata note. */
|
|
bool code_object_kernels(const void* elf, size_t size, std::vector<KernelMeta>* out,
|
|
std::string* why);
|
|
|
|
/* ------------------------------------------------------------------ fence policy
|
|
*
|
|
* Extra fence scope for the next dispatch on this thread, beyond the agent scope every kernel
|
|
* gets. Set by the backend around its own blits; cleared by the dispatch that consumes it. */
|
|
enum : uint8_t { kFenceAcquireSystem = 1, kFenceReleaseSystem = 2 };
|
|
void set_next_fence(uint8_t f);
|
|
|
|
} // namespace aql
|
|
} // namespace rad
|
|
|
|
struct RadCopyRange;
|
|
|
|
/* Blit kernel launchers, defined in aql_blit.hip. Each issues one kernel onto `stream` through
|
|
* hipLaunchKernel, which the backend intercepts. The caller guarantees alignment: the 16-byte
|
|
* forms need both addresses and the length 16-byte aligned. */
|
|
extern "C" {
|
|
/* `link`: either side is pinned host memory, so use one narrow workgroup instead of a full grid
|
|
* (see aql_blit.hip). */
|
|
int rad_aql_blit_copy(void* dst, const void* src, uint64_t bytes, void* stream, bool link = false);
|
|
int rad_aql_blit_copy2d(void* dst, uint64_t dpitch, const void* src, uint64_t spitch,
|
|
uint64_t width, uint64_t height, void* stream);
|
|
int rad_aql_blit_fill(void* dst, int value, uint64_t bytes, void* stream);
|
|
/* rad_memcpy_ranges_async's kernel: `prefix` a multiple of 16, both bases 16-byte aligned. */
|
|
int rad_aql_blit_ranges(void* dst, const void* src, uint64_t prefix, const RadCopyRange* ranges,
|
|
int n, void* stream);
|
|
}
|