Archived
libxe2: the Intel kernel library's skeleton, and its first op, add
libxe2 is a kernel plugin like any other, built by rad_add_plugin from the icpx sub-build into the build tree's $RADIANCE_HOME. It declares no schemas (every op it serves is libref's vocabulary), only device rows, written with designated initialisers. xe2_common.h holds what every kernel needs: the launch's queue (rad_sycl.h), row views over padded operands, refusals that name the geometry, and libref's own dtype conversions so results round where the reference's do. add passes rad-kbench against libref at tolerance zero, on the recorded fixture (30 cases) and on MiniCPM5-2B's container (20 cases), inside guarded allocations. In a SYCL build the kbench replays run libxe2 on the card, so they are labelled sycl there, as they are gpu in a HIP build. scripts/sycl/notify.sh posts to the Discord webhook when the port needs the user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
1 parent
8addda231b
commit
ea065f596c
11 files changed
+362
-10
No files matched your search
+53
-9
@@ -17,7 +17,10 @@ from it alone.
|
||||
|
||||
## Open blockers / questions for the user
|
||||
|
||||
1. **No `.rad` container for any milestone model is in `/mnt/model-library`.**
|
||||
1. ~~**No `.rad` container for any milestone model is in `/mnt/model-library`.**~~ Resolved for bf16
|
||||
(2026-10-23): `StillDeadcode/minicpm5-2b-bf16/minicpm5-2b-bf16.rad` (5,501,632,512 bytes) appeared;
|
||||
copied to `/models/minicpm5-2b-bf16/` and verified with `cmp`. **Still missing: `minicpm5-2b-fp8.rad`**
|
||||
(Milestone B). Original note:
|
||||
`StillDeadcode/minicpm5-2b-bf16/` holds only `README.md` and `minicpm5-2b-bf16-dspark.recipe`; there
|
||||
is no `minicpm5-2b-bf16.rad`, no `minicpm5-2b-fp8.rad`, and no raw `openbmb/MiniCPM5-2B` /
|
||||
`MiniCPM5-2B-DSpark` checkpoint to convert from. A `find -iname '*.rad'` over the library and
|
||||
@@ -31,9 +34,9 @@ from it alone.
|
||||
brought up and compared against the host backend on until the real containers exist.
|
||||
Optionally, `HuggingFaceTB/SmolLM2-135M` (real bf16 llama weights, head_dim 64, tied embeddings)
|
||||
could be converted as a real-weights check; that needs the user's OK, since it is a conversion.
|
||||
3. **No ROCm on this machine** (`hipcc` absent, no `/opt/rocm`). "The HIP build must still compile"
|
||||
cannot be checked here; it needs a ROCm host or a ROCm container (the repo's `Dockerfile` may
|
||||
serve). Until then, HIP-side edits are kept to a minimum and listed below for review.
|
||||
3. **No ROCm on this machine** (`hipcc` absent, no `/opt/rocm`), and `sudo` needs a password. The user
|
||||
authorized installing what is needed; the HIP compile check runs in docker instead
|
||||
(`rocm/dev-ubuntu-24.04:10.1.0-full`, the Dockerfile's base, stock clang; see "HIP compile check").
|
||||
|
||||
## Phase 0 results (2026-10-23)
|
||||
|
||||
@@ -236,13 +239,54 @@ Planned use: Milestone A = `minicpm5-2b-bf16.rad` (blocked, item 1); Milestone B
|
||||
- SYCL build, `ctest -LE 'gpu|oot'` with the oneAPI environment loaded (card present, hidden):
|
||||
83/88, the baseline's failures (FFmpeg, CPU budgets); `trigger_test`'s load flake did not occur.
|
||||
|
||||
## libxe2 (started 2026-10-23)
|
||||
|
||||
`libxe2/` is built by the sycl sub-build with `rad_add_plugin` into `radiance_home/kernels`
|
||||
(`xe2_common.h`: queue, row views, refusals; `xe2_rows.cpp`: rows with designated initialisers).
|
||||
Ops so far: `add`.
|
||||
|
||||
**The correctness check for every op is `rad-kbench`**: it replays each kernel against libref's
|
||||
recorded answers on seeded inputs inside guarded allocations (`data/kernels.rkb`, recorded from
|
||||
qwen3.8-27b; `kernels_moe.rkb`), at the project's per-op tolerances, and with `-m` against a real
|
||||
container at its geometry. In a SYCL build the `kbench` and `kbench_moe` tests are labelled
|
||||
`kbench;sycl` (card tier), as they are `kbench;gpu` in a HIP build. Per op:
|
||||
|
||||
```sh
|
||||
. /opt/intel/oneapi/setvars.sh
|
||||
RADIANCE_SYCL_TIMING=1 RADIANCE_HOME=$PWD/build-sycl/radiance_home build-sycl/bin/rad-kbench --op <op>
|
||||
RADIANCE_SYCL_TIMING=1 RADIANCE_HOME=$PWD/build-sycl/radiance_home build-sycl/bin/rad-kbench \
|
||||
-m /models/minicpm5-2b-bf16/minicpm5-2b-bf16.rad --num-speculative-tokens 0 --op <op>
|
||||
```
|
||||
|
||||
`add`: fixture 30/30 and MiniCPM5 20/20, worst rel_l2 0, no writes outside guarded allocations.
|
||||
`ctest -L '^sycl$'` (device_test_sycl, kbench, kbench_moe): 3/3 on the B65.
|
||||
|
||||
In a SYCL build the host tier is `ctest -LE 'gpu|oot|sycl'` (kbench moved to the card tier).
|
||||
|
||||
### MiniCPM5-2B bf16, the real container (`--debug-graph`, host backend)
|
||||
|
||||
42 layers, n_embd 2048, 16 q / 2 kv heads, head_dim 128 (gqa 8), ffn 6144, vocab 130560, rope theta
|
||||
5e6 neox, eps 1e-6. With `--num-speculative-tokens 0`: 523 ops, exactly the 13 + 13 of
|
||||
`SYCL_PORTING.md` §3.1 (gemm_nt at N,K = 2560x2048 qkv, 2048x2048 o, 12288x2048 gate_up,
|
||||
2048x6144 down; logits 130560x2048). With its DSpark drafter (default, depth 7): 619 ops, adding
|
||||
`gemm_nt_q` fp8a8 (128x128 blocks) and `w2a8` (the 2-bit head), `gemm_nt_q_gated`, `silu_mul`,
|
||||
`quant_act_i8`, `row_topk` (N 130560, R 16), `dflash_select`, a non-causal `attn_paged`, and
|
||||
`rmsnorm` n=128. Milestone A runs with speculation off first; the drafter's ops are Milestone B.
|
||||
|
||||
## Next steps
|
||||
|
||||
1. `libxe2/` skeleton built by the icpx sub-build, installed under `radiance_home/kernels`, with one
|
||||
op (`add`) and a libref-checked test on the card (`sycl` label); its `oot` rebuild.
|
||||
2. `code_runs` under SYCL from `build_target` (D4), so a host-only build target never claims the card.
|
||||
3. Phase 3: the 13 + 13 ops of `SYCL_PORTING.md` §3.1, each with a libref test, then the tiny
|
||||
llama end to end against the host backend.
|
||||
1. Phase 3, Milestone A's 13 + 13 ops in libxe2, each passing `rad-kbench` (fixture and MiniCPM5),
|
||||
correctness-first kernels. Order: elementwise/norm/rope/cast/embed/gather, sampler, gemm_nt and
|
||||
logits_gemm, kv_store and attn_paged.
|
||||
2. Then serve MiniCPM5 on the B65 with `--num-speculative-tokens 0` and compare greedy output with
|
||||
the host backend.
|
||||
3. `code_runs` under SYCL from `build_target` (D4); install rules and the `oot` rebuild for
|
||||
`librad_sycl.so` and libxe2.
|
||||
|
||||
## Notifications
|
||||
|
||||
`scripts/sycl/notify.sh "msg"` posts to the Discord webhook (user's request, 2026-10-23): used for
|
||||
blockers, questions and milestones. Tested: posted.
|
||||
|
||||
## HIP-side edits awaiting a ROCm compile check
|
||||
|
||||
|
||||
Reference in new issue
Block a user