Merge hugypufy/radiance m2xfp: M2XFP4 weights (upstream PR #203)

The M2XFP4 encoding (e2m1 codes, e8m0 per-32 scales, a u8 per-subgroup metadata plane, learned
Givens rotations): libref and libavx kernels, libr4d HIP kernels, the packer and the tests, as on
the branch (8 commits on 9eaf10d, radiance 1.11.0). Taken for Qwen3.8-27B-DFLASH2-PARO-M2XFP4,
the container used for testing and optimisation from now on; merged without conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-10-23 23:09:18 +02:00
commit d3609e585d
68 files changed
+4847 -193

No files matched your search

+23
View File
@@ -240,6 +240,24 @@ endforeach()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/vectors/LICENSE.qwen-community-1.0.txt
DESTINATION ${CMAKE_INSTALL_DOCDIR}/third_party RENAME qwen-community.LICENSE)
# The M2XFP4 rows at the 27B trunk's own geometries: no in-tree container carries the encoding,
# so this is recorded from a skeleton of an m2xfp4 conversion (weights drawn from seeds) at the
# band edges a max-tok pass lands on -- one file a pass, replayed together. Re-record with
#
# rad-kbench -m <m2-container.rad> --max-cases 1 --max-tok <1|8|16|128> \
# --record data/kernels_m2xfp4_m<tok>.rkb
#
set(RAD_M2XFP4_FIXTURES "")
foreach(tok 1 8 16 128)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/data/kernels_m2xfp4_m${tok}.rkb)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/kernels_m2xfp4_m${tok}.rkb
${RAD_PLUGIN_OUT}/kernels_m2xfp4_m${tok}.rkb COPYONLY)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/kernels_m2xfp4_m${tok}.rkb
DESTINATION ${CMAKE_INSTALL_DATADIR}/radiance)
list(APPEND RAD_M2XFP4_FIXTURES ${RAD_PLUGIN_OUT}/kernels_m2xfp4_m${tok}.rkb)
endif()
endforeach()
# The downloader behind `radiance --model <owner/name>` (core/hf_model.cpp). The engine looks in
# <bin>/../libexec/radiance/, so the build tree mirrors that layout.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/hfget.sh
@@ -254,6 +272,11 @@ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/hfget.sh
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/rad-export
DESTINATION ${CMAKE_INSTALL_BINDIR})
# rad-pack-m2xfp4 (a ParoQuant M2XFP4 fine-tune to a .rad, through the import) drives rad-convert
# and checks its output; it is Python, like rad-export.
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/rad_pack_m2xfp4.py
DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME rad-pack-m2xfp4)
# rad_add_plugin() and rad_hipify(), shared with the installed package config. The variables it
# expects are all set above.
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/RadAddPlugin.cmake)