[PR #3447] [CLOSED] [Engine] CUDA 12.0/12.1: widen the f32 bits by hand in the q36 VDEBUG print #4638

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3447
Author: @rodi4eg
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: pr/cuda120-host-call


📝 Commits (1)

  • f061dfc [Engine] CUDA 12.0/12.1: widen the f32 bits by hand in the q36 VDEBUG print

📊 Changes

1 file changed (+6 additions, -3 deletions)

View changed files

📝 src/qwen35/q36_engine.cu (+6 -3)

📄 Description

Problem and result

__half_as_ushort and __float2half are __device__ only, so a host function cannot call them, and CUDA 12.0 and 12.1 reject the call. This site is still in the tree, so the engine does not build with those toolkits:

src/qwen35/q36_engine.cu:1659:  (unsigned) __half_as_ushort(__float2half(t[0]));
error: identifier "__half_as_ushort" is undefined in device code

0.1.44.1 fixed the sibling site the same way (ab638a56: "the PR widens the bits by hand, as the BF16 loader next to it does"). This change does the same for this one.

With the change the tree builds with CUDA 12.0 and 12.1.

none

Approach

Three lines in src/qwen35/q36_engine.cu: read the f32 bits with a memcpy and print them, instead of converting to half on the host.

The printed value changes from the half-rounded bits to the f32 bits. It is a debug line (it only runs under STRATA_Q36_VDEBUG), and it takes no part in any decision the engine makes.

Validation

Passed:

  • The engine builds with CUDA 12.0 (nvcc 12.0.140) for sm_89 and serves requests; the same build without the change fails with the error above.
  • The engine's own parity tools pass with the change in place.

Failed:

  • none observed

Not run:

  • HIP, SYCL and Metal builds. This file is CUDA-only in our build (strata_qwen35 is CUDA; the q36 path is excluded for HIP gfx906), and there is no ROCm or Intel toolchain on this machine, so the HIP build of this file was not checked.
  • Windows (MSVC) was not tried.

Limits

  • Only the one call site is changed. If the same pattern appears elsewhere in the CUDA sources, it will need the same treatment; this PR does not look for it.
  • The debug print now shows the f32 bits, which is what the code around it compares anyway.

🔄 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/3447 **Author:** [@rodi4eg](https://github.com/rodi4eg) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/cuda120-host-call` --- ### 📝 Commits (1) - [`f061dfc`](https://github.com/Niko1221/Strata/commit/f061dfca8b722d74cdf2e7f69d3ceeab3b001e24) [Engine] CUDA 12.0/12.1: widen the f32 bits by hand in the q36 VDEBUG print ### 📊 Changes **1 file changed** (+6 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/qwen35/q36_engine.cu` (+6 -3) </details> ### 📄 Description ## Problem and result `__half_as_ushort` and `__float2half` are `__device__` only, so a host function cannot call them, and **CUDA 12.0 and 12.1 reject the call**. This site is still in the tree, so the engine does not build with those toolkits: ``` src/qwen35/q36_engine.cu:1659: (unsigned) __half_as_ushort(__float2half(t[0])); error: identifier "__half_as_ushort" is undefined in device code ``` 0.1.44.1 fixed the sibling site the same way (ab638a56: "the PR widens the bits by hand, as the BF16 loader next to it does"). This change does the same for this one. With the change the tree builds with CUDA 12.0 and 12.1. ## Related discussion none ## Approach Three lines in `src/qwen35/q36_engine.cu`: read the f32 bits with a `memcpy` and print them, instead of converting to half on the host. The printed value changes from the half-rounded bits to the f32 bits. It is a debug line (it only runs under `STRATA_Q36_VDEBUG`), and it takes no part in any decision the engine makes. ## Validation **Passed:** - The engine builds with CUDA 12.0 (nvcc 12.0.140) for sm_89 and serves requests; the same build without the change fails with the error above. - The engine's own parity tools pass with the change in place. **Failed:** - none observed **Not run:** - HIP, SYCL and Metal builds. This file is CUDA-only in our build (`strata_qwen35` is CUDA; the q36 path is excluded for HIP gfx906), and there is no ROCm or Intel toolchain on this machine, so the HIP build of this file was not checked. - Windows (MSVC) was not tried. ## Limits - Only the one call site is changed. If the same pattern appears elsewhere in the CUDA sources, it will need the same treatment; this PR does not look for it. - The debug print now shows the f32 bits, which is what the code around it compares anyway. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:37:59 +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#4638
No description provided.