Archived
radiance 1.7.0
- 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
This commit is contained in:
1 parent
b068190326
commit
1e968f6e1d
739 files changed
+128447
-84632
No files matched your search
+43
-52
@@ -1,47 +1,37 @@
|
||||
# tools/ -- rad-info, rad-convert, rad-kbench, rad-tune, and the smaller checkers below.
|
||||
#
|
||||
# The rad_add_tool tools link rad_core, and they do that rather than reimplementing anything
|
||||
# because three of them ARE the engine's startup with a different last step: rad-convert,
|
||||
# rad-kbench and rad-tune each load the same plugins in the same hierarchy and run the same
|
||||
# declare phase (spec §4.2, §15, §17). A tool that resolved kernels differently from the engine
|
||||
# would be a tool whose answers are about a different program.
|
||||
# rad_add_tool tools link rad_core: rad-convert, rad-kbench and rad-tune are the engine's startup
|
||||
# with a different last step, loading the same plugins in the same hierarchy and running the same
|
||||
# declare phase (spec §4.4, §15, §17), so they resolve kernels exactly as the engine does.
|
||||
#
|
||||
# iface.cpp is the seam onto core/plugin and core/build; opshapes.cpp is the operand sizing
|
||||
# rad-kbench and rad-tune share, and kfixture.cpp the recorded kernel fixture and its input draw.
|
||||
# All three are compiled into each tool rather than made a library -- three files against four
|
||||
# small binaries is not worth a target.
|
||||
# iface.cpp is the seam onto core/plugin and core/build and the flag parsing every tool shares,
|
||||
# opshapes.cpp the operand sizing shared by rad-kbench and rad-tune, kfixture.cpp the recorded
|
||||
# kernel fixture and its input draw, and kbench_core.cpp rad-kbench's rules (comparison,
|
||||
# tolerances, keys, the reference cache). They are compiled into each tool; a library target is not
|
||||
# worth it for four files.
|
||||
|
||||
set(RAD_TOOL_SHARED
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/iface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opshapes.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kfixture.cpp)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kfixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kbench_core.cpp)
|
||||
|
||||
function(rad_add_tool name src)
|
||||
add_executable(${name} ${src} ${RAD_TOOL_SHARED})
|
||||
# WHOLE_ARCHIVE, for the same reason as ENABLE_EXPORTS below and it is the other half of it.
|
||||
# A static archive yields only the objects that resolve a symbol the executable itself
|
||||
# references, and rad-convert never calls rad_issue -- so without it core/runtime/issue.cpp is
|
||||
# dropped from the link and the architecture plugin, which DOES call it from its step function,
|
||||
# fails to load with "undefined symbol: rad_issue". A host that dlopens a plugin has to present
|
||||
# the WHOLE plugin-facing ABI, declare phase and run phase alike, whether or not it uses all of
|
||||
# it.
|
||||
# WHOLE_ARCHIVE: a host that dlopens a plugin must present the whole plugin-facing ABI, declare
|
||||
# and run phase alike. A plain archive link drops objects the tool does not reference (e.g.
|
||||
# rad-convert never calls rad_issue), and the architecture plugin then fails to load.
|
||||
target_link_libraries(${name} PRIVATE "$<LINK_LIBRARY:WHOLE_ARCHIVE,rad_core>")
|
||||
target_include_directories(${name} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/core
|
||||
${CMAKE_SOURCE_DIR}/abi)
|
||||
# NO HOME DEFINITION HERE. rad_abi carries RAD_DEFAULT_HOME to everything that links it, the
|
||||
# engine and the tools alike, and iface.cpp's rad_home() reads that macro, so there is ONE
|
||||
# definition of the default home. A second one derived from the install prefix would put the
|
||||
# tools one directory away from core/config.cpp's default, and nothing would show it until an
|
||||
# install: "no plugins" reads the same whichever wrong directory it came from.
|
||||
# No home definition here: rad_abi carries RAD_DEFAULT_HOME to the engine and tools alike, and
|
||||
# iface.cpp's rad_home() reads it, so there is one default home.
|
||||
#
|
||||
# ENABLE_EXPORTS, and it is load-bearing rather than tidy. The declare-phase C ABI
|
||||
# (rad_decl_weight, rad_decl_op, rad_declare_logits, ...) is implemented by the HOST and an
|
||||
# architecture plugin binds to it at dlopen. Without --export-dynamic those symbols are not in
|
||||
# the executable's dynamic table and EVERY architecture plugin fails to load with "undefined
|
||||
# symbol: rad_decl_weight". Kernel plugins do not need it -- they only export -- which is why
|
||||
# rad-schemas and r4d_selftest work without it.
|
||||
# ENABLE_EXPORTS is required: the host implements the declare-phase C ABI (rad_decl_weight,
|
||||
# rad_decl_op, rad_declare_logits, ...) and an architecture plugin binds to it at dlopen. Kernel
|
||||
# plugins only export, so rad-schemas and r4d_selftest do not need it.
|
||||
set_target_properties(${name} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
ENABLE_EXPORTS ON)
|
||||
@@ -49,57 +39,58 @@ endfunction()
|
||||
|
||||
rad_add_tool(rad-info rad_info.cpp)
|
||||
|
||||
# The tokeniser's reference encoder: an independent encode path (tokref.h) that core/text's
|
||||
# pre-tokeniser compiler is held to. A library rather than a tool source because
|
||||
# tests/tokenizer_test compares against it too; nothing in core/ links it.
|
||||
# The tokeniser's independent reference encoder (tokref.h), which core/text's pre-tokeniser is
|
||||
# checked against. A library because tests/tokenizer_test uses it too; core/ does not link it.
|
||||
add_library(rad_tokref STATIC ${CMAKE_CURRENT_SOURCE_DIR}/tokref.cpp)
|
||||
target_link_libraries(rad_tokref PUBLIC rad_core)
|
||||
target_include_directories(rad_tokref PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/core)
|
||||
|
||||
# rad-tokcheck needs neither plugins nor the declare phase, so it links the core plainly rather
|
||||
# than through rad_add_tool's whole-archive link.
|
||||
add_executable(rad-tokcheck rad_tokcheck.cpp)
|
||||
# rad-tokcheck needs neither plugins nor the declare phase, so it links the core plainly.
|
||||
add_executable(rad-tokcheck rad_tokcheck.cpp ${CMAKE_CURRENT_SOURCE_DIR}/iface.cpp)
|
||||
target_link_libraries(rad-tokcheck PRIVATE rad_tokref rad_core)
|
||||
set_target_properties(rad-tokcheck PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# Not a rad_add_tool: it links no core at all, deliberately. It dlopens plugins and reads their
|
||||
# static schema tables, so it works on a plugin the engine cannot even load -- which is exactly
|
||||
# when you need it.
|
||||
# rad-schemas links no core: it dlopens plugins and reads their static schema tables, so it works on
|
||||
# a plugin the engine cannot load.
|
||||
add_executable(rad-schemas rad_schemas.cpp)
|
||||
target_link_libraries(rad-schemas PRIVATE rad_abi ${CMAKE_DL_LIBS})
|
||||
set_target_properties(rad-schemas PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
rad_add_tool(rad-convert rad_convert.cpp)
|
||||
# OpenMP across weights, and within a large one. Without it the same code runs one thread.
|
||||
# Optional OpenMP across weights and within a large one.
|
||||
find_package(OpenMP QUIET)
|
||||
if(OpenMP_CXX_FOUND)
|
||||
target_link_libraries(rad-convert PRIVATE OpenMP::OpenMP_CXX)
|
||||
else()
|
||||
message(STATUS "rad-convert: no OpenMP -- conversion will run single-threaded")
|
||||
endif()
|
||||
rad_add_tool(rad-kbench rad_kbench.cpp)
|
||||
# The timing pass (--bench): the only part of rad-kbench that needs the device layer's internals.
|
||||
target_sources(rad-kbench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/kbench_timer.cpp)
|
||||
rad_add_tool(rad-tune rad_tune.cpp)
|
||||
|
||||
# The GBNF mask engine's acceptance run: the differential and latency suite of tests/gbnf_test.cpp
|
||||
# against a real tokenizer.json and chat template, given by path. Not a rad_add_tool -- it loads no
|
||||
# plugin and declares nothing -- and not installed: it compiles in upstream's candidate walk as its
|
||||
# oracle, which is test code (tests/gbnf_oracle.cpp) and belongs in no shipped binary.
|
||||
add_executable(rad-gbnf-check rad_gbnf_check.cpp ${CMAKE_SOURCE_DIR}/tests/gbnf_oracle.cpp)
|
||||
# GBNF mask engine acceptance run: tests/gbnf_test.cpp's differential and latency suite against a
|
||||
# real tokenizer.json and chat template. It loads no plugin, and is not installed because it
|
||||
# compiles in test code (tests/gbnf_oracle.cpp, upstream's candidate walk) as its oracle.
|
||||
add_executable(rad-gbnf-check rad_gbnf_check.cpp ${CMAKE_SOURCE_DIR}/tests/gbnf_oracle.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/iface.cpp)
|
||||
target_link_libraries(rad-gbnf-check PRIVATE rad_core)
|
||||
target_include_directories(rad-gbnf-check PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/core ${CMAKE_SOURCE_DIR}/abi ${CMAKE_SOURCE_DIR}/tests)
|
||||
${CMAKE_SOURCE_DIR}/core ${CMAKE_SOURCE_DIR}/abi ${CMAKE_SOURCE_DIR}/tests
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set_target_properties(rad-gbnf-check PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# rad-schemas is the tool an installed prefix needs most: it links no core, so it reads a plugin's
|
||||
# static schema tables on a plugin the engine cannot even load -- which is exactly the position
|
||||
# somebody debugging their own out-of-tree plugin is in. The four exports it needs are the four
|
||||
# every kernel plugin has, so it answers before anything else in the stack will.
|
||||
# rad-schemas matters most in an installed prefix: it needs only the four exports every kernel
|
||||
# plugin has, so it can debug an out-of-tree plugin the engine cannot load.
|
||||
install(TARGETS rad-info rad-convert rad-kbench rad-tune rad-schemas rad-tokcheck
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
# rad-chatparse: the reply parser's acceptance run against a checkpoint's real tokenizer and chat
|
||||
# template, beside the legacy parser in tests/legacy/. It shares the differential harness and that
|
||||
# parser with tests/chatparse_test, so it exists only in a build that has the tests.
|
||||
# template, compared with the legacy parser in tests/legacy/. It shares that parser and the
|
||||
# differential harness with tests/chatparse_test, so it is built only with the tests.
|
||||
if(RAD_BUILD_TESTS)
|
||||
add_executable(rad-chatparse rad_chatparse.cpp)
|
||||
add_executable(rad-chatparse rad_chatparse.cpp ${CMAKE_CURRENT_SOURCE_DIR}/iface.cpp)
|
||||
target_link_libraries(rad-chatparse PRIVATE rad_legacy_toolparse)
|
||||
target_include_directories(rad-chatparse PRIVATE ${CMAKE_SOURCE_DIR}/core ${CMAKE_SOURCE_DIR}/abi)
|
||||
target_include_directories(rad-chatparse PRIVATE ${CMAKE_SOURCE_DIR}/core ${CMAKE_SOURCE_DIR}/abi
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set_target_properties(rad-chatparse PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
endif()
|
||||
Reference in new issue
Block a user