Skip to content

pi0.5 SYCL: FoldQuant fast path on main's SYCL stack; cached vision graph; vla_encode_images - #44

Closed
hungho77 wants to merge 2 commits into
mainfrom
feat/pi05-multi-device
Closed

hungho77 wants to merge 2 commits into
mainfrom
feat/pi05-multi-device

Conversation

@hungho77

@hungho77 hungho77 commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Rebased onto main (#41's SYCL stack is the base). Ports only what #41 lacks:

  • FoldQuant: INT4×INT4 DPAS GEMMs for W4A4 sites; fused q/k/v and gate/up sites (GEGLU into the down act); the expert's adaRMS and gated residuals fused into its act nodes and o/down epilogues; one-node prefix q/k/v+RoPE+F16 pack and expert q/k/v+RoPE+attention (sycl-tla, VLA_SYCL_TLA_DIR). These register through main's hook registry; main's oneDNN SDPA keeps all other attention.
  • Vision tower as one cached graph; the prefix is a single input (no CONCAT).
  • vla_encode_images (C/C++/Python) and vla-server --warmup.

Arc B390, 2 views, 224 px (min ms): FoldQuant W8A8 238→120, W4A4 220→89, W4A4-od8 223→97. BF16 checkpoints are unchanged: actions are bit-identical to main, and timings are the same.

Tests: ctest (SYCL and CPU builds) and fmha_sycl_check pass.

@hungho77
hungho77 requested a review from khanhnd61-vr October 16, 2026 09:22
From #44. ModelArchBase::encode_images (default: unsupported), vla::encode_images,
the C entry point vla_encode_images and Model.encode_images in the Python
binding: the output is what Inputs::precomputed_img_emb takes, so the vision
tower can run in another process or on another device than the LM and action
head. vla-server --warmup N (default 1) runs dummy predicts before binding, so
the first request does not pay for kernel JIT and graph builds.
…graph, no prefix CONCAT

Ports what #44 has that main's SYCL stack (#41) does not, on top of it. main's
hook registry, oneDNN SDPA, fused elementwise nodes, BF16 activations, W8A8 and
KvSlot paths are unchanged; a BF16 checkpoint gives the same actions as before.

FoldQuant (pi0.5 GGUFs with integer sites), with VLA_SYCL_TLA_DIR set:
- W4A4 sites on INT4 x INT4 DPAS GEMMs (src/sycl/vla_sycl_s4gemm.cpp). Only
  when built in; otherwise INT4 activations stay one code per byte for oneDNN.
- q/k/v and gate/up as one fused site each, the GEGLU in the gate/up epilogue
  and straight into the down act (fq_glu_act); the expert's adaRMS in its act
  nodes and its gated residuals in the o/down epilogues.
- The prefix q/k/v GEMM, RoPE and F16 packing as one node (fq_rope_pack), and
  the expert's q/k/v, RoPE and attention over the prefix keys as one node
  (fq_rope_attn), reading the prefix K/V in place (src/sycl/vla_sycl_fmha.cpp,
  layers/fq_rope_attn.h, layers/fmha_kv.h).
- The SigLIP tower takes main's fused BF16 blocks, as on a BF16 checkpoint.
The sycl-tla kernels register through main's registry, ahead of the BF16 entry
(sycl_ext_register's new `front`), and of FLASH_ATTN_EXT claim only the
attention over an fq_rope_pack node; the rest stays on oneDNN's SDPA. The A/B
switches read env_flag, so VLA_FQ_SYCL_GEMM=0 no longer turns the fusions off.
#44's own ViT kernels and its encoder/q|k|v weight changes are not taken.

Graph: the vision tower is one cached graph per view count (the fused blocks
take every view in one pass; the per-op tower runs one view at a time in the
same graph, each writing its rows of one output), and the prefix is one input,
image rows then language rows scaled on the host, instead of a CONCAT.

Arc B390 (2 views, 224 px, 48 tokens; best of 3 interleaved, min ms):
  FoldQuant W8A8     238.3 -> 119.8
  FoldQuant W4A4     220.3 ->  89.1
  FoldQuant W4A4od8  222.6 ->  96.5
  BF16, defaults / --act-dtype bf16 / W4A8: unchanged (273.6 / 169.5 / 91.3)

Tests: ctest (SYCL and CPU builds), fmha_sycl_check.
hungho77 added a commit that referenced this pull request Oct 22, 2026
From #44. ModelArchBase::encode_images (default: unsupported), vla::encode_images,
the C entry point vla_encode_images and Model.encode_images in the Python
binding: the output is what Inputs::precomputed_img_emb takes, so the vision
tower can run in another process or on another device than the LM and action
head. vla-server --warmup N (default 1) runs dummy predicts before binding, so
the first request does not pay for kernel JIT and graph builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVqwCf94Mf4XMBgUvydVJx
hungho77 added a commit that referenced this pull request Oct 22, 2026
…graph, no prefix CONCAT

Ports what #44 has that main's SYCL stack (#41) does not, on top of it. main's
hook registry, oneDNN SDPA, fused elementwise nodes, BF16 activations, W8A8 and
KvSlot paths are unchanged; a BF16 checkpoint gives the same actions as before.

FoldQuant (pi0.5 GGUFs with integer sites), with VLA_SYCL_TLA_DIR set:
- W4A4 sites on INT4 x INT4 DPAS GEMMs (src/sycl/vla_sycl_s4gemm.cpp). Only
  when built in; otherwise INT4 activations stay one code per byte for oneDNN.
- q/k/v and gate/up as one fused site each, the GEGLU in the gate/up epilogue
  and straight into the down act (fq_glu_act); the expert's adaRMS in its act
  nodes and its gated residuals in the o/down epilogues.
- The prefix q/k/v GEMM, RoPE and F16 packing as one node (fq_rope_pack), and
  the expert's q/k/v, RoPE and attention over the prefix keys as one node
  (fq_rope_attn), reading the prefix K/V in place (src/sycl/vla_sycl_fmha.cpp,
  layers/fq_rope_attn.h, layers/fmha_kv.h).
- The SigLIP tower takes main's fused BF16 blocks, as on a BF16 checkpoint.
The sycl-tla kernels register through main's registry, ahead of the BF16 entry
(sycl_ext_register's new `front`), and of FLASH_ATTN_EXT claim only the
attention over an fq_rope_pack node; the rest stays on oneDNN's SDPA. The A/B
switches read env_flag, so VLA_FQ_SYCL_GEMM=0 no longer turns the fusions off.
#44's own ViT kernels and its encoder/q|k|v weight changes are not taken.

Graph: the vision tower is one cached graph per view count (the fused blocks
take every view in one pass; the per-op tower runs one view at a time in the
same graph, each writing its rows of one output), and the prefix is one input,
image rows then language rows scaled on the host, instead of a CONCAT.

Arc B390 (2 views, 224 px, 48 tokens; best of 3 interleaved, min ms):
  FoldQuant W8A8     238.3 -> 119.8
  FoldQuant W4A4     220.3 ->  89.1
  FoldQuant W4A4od8  222.6 ->  96.5
  BF16, defaults / --act-dtype bf16 / W4A8: unchanged (273.6 / 169.5 / 91.3)

Tests: ctest (SYCL and CPU builds), fmha_sycl_check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVqwCf94Mf4XMBgUvydVJx
@hungho77
hungho77 force-pushed the feat/pi05-multi-device branch 2 times, most recently from 5b0db24 to f10f04a Compare October 22, 2026 08:38
@hungho77 hungho77 changed the title SYCL: pi0.5 on the Arc B390 iGPU (flash attention, fused nodes, INT4 DPAS GEMMs) SYCL: pi0.5 FoldQuant fast path on main's stack (INT4 DPAS GEMMs, fused sites); vla_encode_images Oct 22, 2026
@hungho77 hungho77 changed the title SYCL: pi0.5 FoldQuant fast path on main's stack (INT4 DPAS GEMMs, fused sites); vla_encode_images pi0.5 SYCL: FoldQuant fast path on main's SYCL stack; cached vision graph; vla_encode_images Oct 22, 2026
@hungho77

Copy link
Copy Markdown
Collaborator Author

Superseded by #49.

@hungho77 hungho77 closed this Oct 23, 2026
@hungho77
hungho77 deleted the feat/pi05-multi-device branch October 23, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant