diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-06-11 19:54:11 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-06-14 08:27:10 +0200 |
| commit | 69c612d012ff65135373c66aa5dc9f26ac0b24e3 (patch) | |
| tree | 17fef11047cdee1c620ca0ea76ae167552a87ed0 | |
| parent | 2a4c9932cfebb597422aef5aaa836b084f6e50f4 (diff) | |
| download | ffwd-69c612d012ff65135373c66aa5dc9f26ac0b24e3.tar.gz ffwd-69c612d012ff65135373c66aa5dc9f26ac0b24e3.zip | |
chore: comments housekeeping
| -rw-r--r-- | Makefile | 27 | ||||
| -rw-r--r-- | bench/bench.h | 4 | ||||
| -rw-r--r-- | bench/bench_kernels.c | 2 | ||||
| -rw-r--r-- | embed.h | 6 | ||||
| -rw-r--r-- | embed_mlx.h | 2 |
5 files changed, 17 insertions, 24 deletions
@@ -69,10 +69,6 @@ help: @echo " make debug Debug build with AddressSanitizer" @echo " make clean Remove build artifacts" @echo "" - @echo "Each backend target builds ./$(TARGET) (CLI), ./$(SERVER_TARGET)" - @echo "(HTTP API), the static library $(LIB), and the shared library" - @echo "$(SHARED_LIB) for that backend." - @echo "" @echo "Usage:" @echo " ./pplx-embed -d /path/to/model-dir \"text1\" \"text2\"" @echo " ./pplx-embed-server --model pplx-embed-v1-0.6b=/path/to/model-dir" @@ -155,7 +151,7 @@ TEST_BLAS_CFLAGS = -DUSE_BLAS -DUSE_OPENBLAS -I/usr/include/openblas TEST_BLAS_LDFLAGS = -lopenblas endif -# Source lists shared by `test` and `coverage` so the two cannot drift. +# Source lists shared by test and coverage targets so the two cannot drift. TEST_CC_FLAGS = -Wall -Wextra -O2 -I. TEST_KERNELS_SRCS = tests/test_kernels.c $(KERNEL_SRCS) TEST_TOKENIZER_SRCS = tests/test_tokenizer.c qwen_tokenizer.c $(KERNEL_SRCS) @@ -204,14 +200,13 @@ test: ./tests/test_server # ============================================================================= -# Test-suite line coverage (requires clang + llvm-cov/llvm-profdata; this is -# the default toolchain on macOS. Writes a per-file text summary to stdout -# and a browsable HTML report to coverage/html/index.html.) +# Test-suite line coverage (requires clang + llvm-cov/llvm-profdata. Writes a +# per-file text summary to stdout and an HTML report to coverage/html/index.html.) # ============================================================================= COV_DIR = coverage # Source-based coverage; -O0 so no line is folded away by the optimizer. -# The "." compilation dir keeps report paths relative to the repo root -# (run llvm-cov from the repo root so sources resolve). +# The "." compilation dir keeps report paths relative to the repo root; +# run llvm-cov from the repo root so sources resolve. COV_FLAGS = -fprofile-instr-generate -fcoverage-mapping -O0 \ -fcoverage-compilation-dir=. COV_BINS = tests/test_kernels_generic tests/test_kernels_blas \ @@ -281,9 +276,9 @@ bench-tokenizer: @echo "run: bench/bench_tokenizer <model_dir> [runs]" # ============================================================================= -# Regression microbenchmarks (Go-style; see bench/bench.h). Each run records -# a JSON sample set under bench/results/, keyed by commit; compare two -# records with scripts/benchstat.py to see if a change helped or hurt. +# Regression microbenchmarks (see bench/bench.h). Each run records a JSON +# sample set under bench/results/, keyed by commit; compare two records with +# bench/benchstat.py to see if a change helped or hurt. # ============================================================================= # Dirtiness ignores .gitignore so local-only ignore entries do not mark # every record as -dirty. @@ -295,7 +290,7 @@ bench: bench/bench_kernels.c $(KERNEL_SRCS) -lm -lpthread $(TEST_BLAS_LDFLAGS) @mkdir -p bench/results ./bench/bench_kernels --json bench/results/kernels-$(BENCH_STAMP).json - @echo "compare: scripts/benchstat.py bench/results/OLD.json bench/results/NEW.json" + @echo "compare: ./bench/benchstat.py bench/results/OLD.json bench/results/NEW.json" bench-model: @test -n "$(MODEL_DIR)" || { echo "usage: make bench-model MODEL_DIR=/path/to/model-dir"; exit 1; } @@ -371,6 +366,6 @@ clean: $(TARGET) $(SERVER_TARGET) $(LIB) libpplxembed.dylib libpplxembed.so \ tests/test_kernels_generic tests/test_kernels_blas \ tests/test_safetensors tests/test_bf16_model tests/test_server \ - tests/test_tokenizer tests/test_workspace \ - bench/bench_tokenizer + tests/test_tokenizer tests/test_workspace tests/test_cli tests/test_late \ + tests/cli_under_test bench/bench_tokenizer bench/bench_kernels bench/bench_model rm -rf $(COV_DIR) diff --git a/bench/bench.h b/bench/bench.h index 2c98d5c..9a46c71 100644 --- a/bench/bench.h +++ b/bench/bench.h @@ -1,4 +1,4 @@ -/* bench/bench.h - minimal Go-style microbenchmark harness. +/* bench/bench.h - minimal microbenchmark harness. * * A benchmark function receives a bench_state_t and must run its measured * loop exactly b->n times. Call bench_begin(b) after setup so allocation @@ -14,7 +14,7 @@ * * The harness calibrates n until one run takes at least --benchtime-ms * (default 300), then takes --count (default 10) timed samples and prints - * one Go-style line per benchmark with the median ns/op and the spread. + * one line per benchmark with the median ns/op and the spread. * --json PATH writes every sample plus run metadata for benchstat.py. * --filter SUBSTR runs the matching subset. */ diff --git a/bench/bench_kernels.c b/bench/bench_kernels.c index 7266f05..10b9ea0 100644 --- a/bench/bench_kernels.c +++ b/bench/bench_kernels.c @@ -4,7 +4,7 @@ * 8 KV heads x head_dim 128, intermediate 3072) so a slowdown here predicts * a slowdown in inference. Single-threaded by default for stable numbers; * --threads N opts into the pool. Build and record via `make bench`, - * compare records with scripts/benchstat.py. + * compare records with bench/benchstat.py. */ #include "bench.h" @@ -1,7 +1,5 @@ /* - * embed.h - Pure C inference for Perplexity AI's pplx-embed models. - * - * Supports all pplx-embed-v1 and pplx-embed-context-v1 variants (0.6B, 4B). + * embed.h - pplx-embed API */ #ifndef PPLX_EMBED_H @@ -116,7 +114,7 @@ PPLX_API size_t pplx_workspace_nbytes(const pplx_workspace_t *ws); * 3. Final RMSNorm * 4. Mean pooling over all positions * - * Perplexity embeddings are intentionally not L2-normalized. Use cosine + * pplx-embed-v1 embeddings are intentionally not L2-normalized. Use cosine * similarity for comparisons, or normalize explicitly before storing in vector * databases that only support inner product. * diff --git a/embed_mlx.h b/embed_mlx.h index ccc20c5..be467d0 100644 --- a/embed_mlx.h +++ b/embed_mlx.h @@ -1,5 +1,5 @@ /* - * embed_mlx.h - MLX GPU backend for pplx-embed inference + * embed_mlx.h - MLX GPU backend for Apple Silicon * * Uses Apple's mlx-c to run the transformer on Metal. */ |
