[PR #2327] [CLOSED] qwen35: widen F16 by hand so upload_f32 builds on CUDA 12.1 #3983

Closed
opened 2026-11-07 15:32:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2327
Author: @nekomario28
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: q36-f16-widen-host


📝 Commits (1)

  • c5f8fa5 qwen35: widen F16 by hand so upload_f32 builds on CUDA 12.1

📊 Changes

1 file changed (+31 additions, -2 deletions)

View changed files

📝 src/qwen35/q36_engine.cu (+31 -2)

📄 Description

Fixes Niko1221/Strata#2322.

upload_f32 runs on the host and widens F16 with __half2float(__ushort_as_half(...)). __ushort_as_half is a __device__ intrinsic, so on CUDA toolkits that do not have a host form (12.1 and 12.4 per the report) nvcc refuses it:

src/qwen35/q36_engine.cu:809: calling a __device__ function "__ushort_as_half(unsigned short)" from a __host__ function "upload_f32" is not allowed

This widens the bits the way the neighbouring bf16_to_f32 already does for BF16, so the host path stops naming a device intrinsic and the file compiles on every toolkit.

Testing

  • scripts/syntax_check.sh src/qwen35/q36_engine.cu (HIP compat shim) passes; it passed before too, so it is a regression guard here, not a reproduction of the CUDA-only error.
  • The conversion itself was checked against a reference for every 16-bit input: f16_to_f32 matches NumPy's float16 -> float32 bit-for-bit across all 65536 values (0 mismatches; NaN treated as a class). That covers the subnormal branch.
  • Not run: a real CUDA build (no NVIDIA toolchain here), which is the build the report is about. AGENTS.md asks for builds of touched backends; this is the boundary.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2327 **Author:** [@nekomario28](https://github.com/nekomario28) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `q36-f16-widen-host` --- ### 📝 Commits (1) - [`c5f8fa5`](https://github.com/Niko1221/Strata/commit/c5f8fa5db74c41d5271ece3eacee5013ed0e18bc) qwen35: widen F16 by hand so upload_f32 builds on CUDA 12.1 ### 📊 Changes **1 file changed** (+31 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/qwen35/q36_engine.cu` (+31 -2) </details> ### 📄 Description Fixes Niko1221/Strata#2322. `upload_f32` runs on the host and widens F16 with `__half2float(__ushort_as_half(...))`. `__ushort_as_half` is a `__device__` intrinsic, so on CUDA toolkits that do not have a host form (12.1 and 12.4 per the report) `nvcc` refuses it: ``` src/qwen35/q36_engine.cu:809: calling a __device__ function "__ushort_as_half(unsigned short)" from a __host__ function "upload_f32" is not allowed ``` This widens the bits the way the neighbouring `bf16_to_f32` already does for BF16, so the host path stops naming a device intrinsic and the file compiles on every toolkit. ## Testing - `scripts/syntax_check.sh src/qwen35/q36_engine.cu` (HIP compat shim) passes; it passed before too, so it is a regression guard here, not a reproduction of the CUDA-only error. - The conversion itself was checked against a reference for every 16-bit input: `f16_to_f32` matches NumPy's `float16` -> `float32` bit-for-bit across all 65536 values (0 mismatches; NaN treated as a class). That covers the subnormal branch. - Not run: a real CUDA build (no NVIDIA toolchain here), which is the build the report is about. AGENTS.md asks for builds of touched backends; this is the boundary. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:32:13 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3983
No description provided.