[Engine] SM70/Volta build fails: q36_engine.cu calls __device__ __half_as_ushort from host function verify_q8
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- backend, build-system
Research direction
Start in src/qwen35/q36_engine.cu at the host-side verify_q8() debug output around line 1659, and check how that translation unit handles host and device half conversions. Replace the host call to __half_as_ushort() with a host-safe way to read the half value's bits. Build the strata and strata_qwen35 targets with STRATA_EXPERIMENTAL_SM60=ON and CUDA architecture 70; done means the build succeeds.
Written by the indexing model from the issue text.
Description
Summary
Building the 0.1.45+ engine with -DSTRATA_EXPERIMENTAL_SM60=ON (Volta / SM70, e.g. Tesla V100) fails: src/qwen35/q36_engine.cu calls the device-only intrinsic __half_as_ushort() from a host function.
Environment
| Strata | main @ 9de04cd4 (Control 0.1.46.3, engine 0.1.46.3) |
| OS | Linux (Ubuntu 24.04) x86_64 |
| GPU | Tesla V100-SXM2-16GB (SM70, driver 580.178.04) |
| CUDA | 12.0.140 (build-cuda12, CMAKE_CUDA_ARCHITECTURES=70) |
| Host compiler | g++-12 (12.4.0) |
| CMake option | STRATA_EXPERIMENTAL_SM60=ON |
Error
src/qwen35/q36_engine.cu(1659): error: calling a __device__ function("__half_as_ushort( ::__half)") from a __host__ function("verify_q8") is not allowed
1 error detected in the compilation of "src/qwen35/q36_engine.cu".
ninja: build stopped: subcommand failed.
setup.sh --update retries the build once, hits the same error, then falls back to the previously installed engine (could not compile the updated engine: starting the installed one), so the update silently no-ops while claiming success.
Cause
verify_q8() is a host function (it only runs under STRATA_Q36_VDEBUG for debug output). Line 1659 casts the fp16 value of the CPU butterfly sum to its bit pattern:
std::fprintf(stderr, "VDEBUG block %zu: ds new %08x old %08x, qs bytes %s, cpu butterfly sum %.9g (half %04x)\n",
blk, ds_a, ds_b, std::memcmp(&a[o + 4], &b[o + 4], 32) == 0 ? "equal" : "DIFFER", (double) t[0],
(unsigned) __half_as_ushort(__float2half(t[0])));
__half_as_ushort is declared __device__ in cuda_fp16.h; on this arch/header combination nvcc does not accept the host call. It is not guarded by #ifdef __CUDA_ARCH__, so the SM60/SM70 path cannot build at all.
Fix
Read the bit pattern on the host directly — same value, no device intrinsic:
unsigned short t0_bits;
{ const __half t0h = __float2half(t[0]); std::memcpy(&t0_bits, &t0h, 2); }
std::fprintf(stderr, "... (half %04x)\n", ..., (unsigned) t0_bits);
(or __half2ushort_rn / union pun; anything host-side). I verified this builds and runs:
cmake --build build-cuda12 --target strata strata_qwen35→ OK./update.sh→engine compiled: .../engine-cuda12/strata,Strata is updated (engine 0.1.46.3)- Model starts,
/health200, 262144 ctx, chat completions work
Suggestion
Guard the debug cast with #if defined(__CUDA_ARCH__) or use the host-safe conversion above, so the SM60 experimental path keeps compiling. Secondarily: when the engine build fails, update.sh exiting 0 with "Strata is updated" is misleading — a non-zero exit code (or a clear "engine NOT updated" banner) would save users from thinking they upgraded when they did not.
- Dominant language
- C++
- Stars
- 11.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Niko1221/Strata
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Niko1221/Strata#3512 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Niko1221/Strata#3501 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 3 days
-
[Benchmark] Community benchmark on AMD Radeon RX 6800 XTX + 48gb of RAM for 256k tokens of contextOpen
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Niko1221/Strata#3468 · 1 comment ·
Maintainers usually reply within 3 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NVIDIA-Omniverse/usd-brep#23 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
qbittorrent/qBittorrent#25121 ·
Maintainers usually reply within 2 days
-
SVT-AV1: Unnecessary size paddingPossibly taken @pszemus claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
strukturag/libheif#1945 ·
Maintainers usually reply within 1 day
-
v9.6.0: CMake incorrectly enforces presence of libevdevPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
mltframework/shotcut#1943 ·
Maintainers usually reply within 1 day