Skip to content

[Engine] sycl inkling: --selfcheck without --native crashed before printing a line - #6638

Open
kgmkm wants to merge 1 commit into
Niko1221:mainfrom
kgmkm:ink-sycl-selfcheck
Open

kgmkm wants to merge 1 commit into
Niko1221:mainfrom
kgmkm:ink-sycl-selfcheck

Conversation

@kgmkm

@kgmkm kgmkm commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

strata-inkling --selfcheck (without --native) dies with SIGSEGV before printing a line — on every release binary (verified here on the shipped 0.1.65 and 0.1.66 sycl packages) and on a local build of v0.2.20, on either GPU.

cmd_selfcheck calls the backend with no model loaded; the SYCL selfcheck() built a StepBatch against a default-constructed manifest and called InkSyRunner::reset_slot(0). reset_slot's only guard is max_slots, whose default is 1, while the sc_hist_* device buffers it dereferences are empty until alloc — the empty vector's operator[] hands dzero a garbage pointer.

#0  ink_sycl::InkSyRunner::reset_slot(int)
#1  ink2::SyclInkBackend::selfcheck(std::string&)

--selfcheck --native <model> was always fine (init loads and allocs first), and the CPU backend passes without a model because it checks its own SIMD kernels instead — which is what --selfcheck (native optional, per the usage line) promises.

Result

--selfcheck with no model prints [selfcheck] PASS backend=sycl (<device> …, SG16): the device-side counterpart of the CPU backend's numerics checks. It runs one SG16 F32 linear kernel (k_linear_f32_sg16) on synthetic data and compares against the scalar reference — proving the runtime came up, USM allocates, kernels compile (AOT or JIT) and compute. reset_slot also tolerates the pre-alloc state now, so no future caller can resurrect the crash.

Validation

Passed (Arc B580 12 GB + Arc Pro B70 32 GB, oneAPI DPC++ 2026.2.0, cmake -DSTRATA_ENABLE_SYCL=ON -DSTRATA_SYCL_TARGETS=spir64,intel_gpu_bmg_g31):

  • unmodified v0.2.20 built the same way, and the shipped strata-inkling-0.1.66-linux-x86_64-sycl package: --selfcheck → SIGSEGV, exit 139, zero output, on both GPUs; --selfcheck --native SQ-20 --gpu 1 → PASS on the B70.
  • with this change (rebased onto v0.2.20, one commit): --selfcheck → PASS on the B580 (default); --selfcheck --native SQ-20 --gpu 1 → PASS on the B70, unchanged; a short serve session unchanged.
  • the repo's own e2e suites against the changed binary: STRATA_INKLING_BIN=<build>/strata-inkling python -m unittest test_inkling_e2e test_inkling_serve_e2e — 5/5 and 2/2 OK (the binary test builds a tiny .strata in-test and drives --selfcheck/--info/--serve at c=1..64 with Vision; needs numpy/zstandard in the venv).

Failed: none on the hardware above.

Not run: CUDA/HIP builds (no toolchains here; their selfcheck paths are untouched), Metal, the fixture parity test (needs a fixture file this machine does not have).

Limits

  • The no-model --selfcheck still lands on the first card even with --gpu N: v0.2.20's set_primary_gpu_index(opts.gpu_index) runs in init(), which the no-model path never enters. Out of scope here (the crash is the problem this fixes); one factory-level line would close it if wanted.

…e and crashed

InkSyRunner::reset_slot read sc_hist_k (empty until alloc) with the default
max_slots of 1, so 'strata-inkling --selfcheck' died with SIGSEGV before
printing a line -- on every release binary, both GPUs here; --selfcheck
--native was fine. Without --native there is no model, no slots and no vocab
to forward: run one SG16 F32 linear kernel against the scalar reference
instead (the device-side counterpart of the CPU backend's SF4/MX8 checks),
and make reset_slot tolerate the pre-alloc state.
@kgmkm
kgmkm force-pushed the ink-sycl-selfcheck branch from 479cf34 to e93af99 Compare November 23, 2026 04:34
@kgmkm

kgmkm commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto v0.2.20 as a single commit (the earlier stack is gone: the serve sampling_keys fix and the SYCL --gpu selection both shipped in v0.2.20, so those two PRs are closed as superseded). Reproduced the crash on the shipped 0.1.66 sycl package and on a local v0.2.20 build, then re-validated the fix per the updated description.

@kgmkm

kgmkm commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

What changed with the v0.2.20 update, for the record:

  • The crash survives it. Reproduced on the shipped strata-inkling-0.1.66-linux-x86_64-sycl and on a local build of v0.2.20 (--selfcheck → SIGSEGV, exit 139, zero output, on both GPUs here; --selfcheck --native → PASS), so the rebase was not academic.
  • v0.2.20 reworked the SYCL lane around the crash site without touching it: the queue now builds from enum_gpu_devices()[primary_gpu_index()] instead of gpu_selector_v, and the lane defaults to the Level-Zero v1 adapter (ensure_l0_v1_default() sets UR_LOADER_USE_LEVEL_ZERO_V2=0). This PR deliberately stays out of that machinery — it changes only the no-model selfcheck path and reset_slot's pre-alloc guard.
  • New gap observed while re-validating (also in the description's Limits): v0.2.20 sets primary_gpu_index only inside init(), which the no-model selfcheck never enters — so --selfcheck --gpu N still lands on the first card. Out of this PR's scope (one factory-level line would close it), noted so it is not lost.
  • Validation now covers the shipped 0.1.66 package, the local v0.2.20 build, and the repo's own inkling e2e suites against the fixed binary (test_inkling_e2e 5/5, test_inkling_serve_e2e 2/2). CI is green on the rebased single-commit branch.

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.

2 participants