mirror of
https://github.com/iafiscal1212/diffuse-cpp.git
synced 2026-12-04 16:48:08 +00:00
- ar-cache.h: append-only KV cache (stores KV heads without GQA expansion) - ar-graph.cpp: forward pass with causal mask (ggml_soft_max_ext) and KV cache - ar-sampler.cpp: token-by-token generation with temp/top-p/top-k/repeat penalty - ar-cli.cpp: CLI tool (diffuse-ar) for autoregressive inference - diffuse-model.cpp: multi-arch GGUF loading (diffuse/qwen2/llama prefixes) - diffuse.h: extended public API with ar_sampler_params and ar_generate() Enables loading llama.cpp GGUF files directly (e.g. Thrombia-32B Q4_K_M). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
59 lines
2.2 KiB
CMake
59 lines
2.2 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(diffuse-cpp VERSION 0.1.0 LANGUAGES C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
# Options
|
|
option(DIFFUSE_BUILD_TESTS "Build tests" ON)
|
|
option(DIFFUSE_BUILD_TOOLS "Build CLI tools" ON)
|
|
|
|
# ── GGML submodule ──────────────────────────────────────────────
|
|
set(GGML_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(GGML_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
set(GGML_OPENMP ON CACHE BOOL "" FORCE)
|
|
add_subdirectory(ggml)
|
|
|
|
# ── Core library (diffusion + autoregressive) ─────────────────
|
|
add_library(diffuse
|
|
src/diffuse-model.cpp
|
|
src/diffuse-graph.cpp
|
|
src/diffuse-sampler.cpp
|
|
src/ar-graph.cpp
|
|
src/ar-sampler.cpp
|
|
)
|
|
target_include_directories(diffuse PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
)
|
|
target_link_libraries(diffuse PUBLIC ggml)
|
|
|
|
# ── CLI tools ───────────────────────────────────────────────────
|
|
if(DIFFUSE_BUILD_TOOLS)
|
|
# Diffusion CLI (LLaDA, Dream)
|
|
add_executable(diffuse-cli tools/main-cli.cpp)
|
|
target_link_libraries(diffuse-cli PRIVATE diffuse)
|
|
|
|
# Autoregressive CLI (Qwen2.5, Llama, etc.)
|
|
add_executable(diffuse-ar tools/ar-cli.cpp)
|
|
target_link_libraries(diffuse-ar PRIVATE diffuse)
|
|
|
|
add_executable(diffuse-bench tools/main-bench.cpp)
|
|
target_link_libraries(diffuse-bench PRIVATE diffuse)
|
|
|
|
add_executable(dump-logits tools/dump-logits.cpp)
|
|
target_link_libraries(dump-logits PRIVATE diffuse)
|
|
|
|
add_executable(diffuse-quantize tools/quantize.cpp)
|
|
target_link_libraries(diffuse-quantize PRIVATE ggml)
|
|
endif()
|
|
|
|
# ── Tests ───────────────────────────────────────────────────────
|
|
if(DIFFUSE_BUILD_TESTS)
|
|
enable_testing()
|
|
add_executable(test-forward tests/test-forward.cpp)
|
|
target_link_libraries(test-forward PRIVATE diffuse)
|
|
add_test(NAME test-forward COMMAND test-forward)
|
|
endif()
|