mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5062] [Engine] put the fallback after an exiting if constexpr branch in its else #5301
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5301
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5062
Author: @slyfox1186
Created: 11/3/2026
Status: 🔄 Open
Base:
main← Head:fix-rows-tsum-unreachable📝 Commits (1)
9d7312b[Engine] put the fallback after an exiting if constexpr branch in its else📊 Changes
5 files changed (+19 additions, -19 deletions)
View changed files
📝
src/kernels/cuda/dflash2.cu(+3 -3)📝
src/kernels/cuda/fused_gr.cu(+2 -2)📝
src/kernels/cuda/iq_kernels.cu(+10 -10)📝
src/kernels/cuda/native_bf16.cu(+2 -2)📝
src/kernels/cuda/native_mmvq.cu(+2 -2)📄 Description
Problem and result
A CUDA build prints nvcc warning #128-D "loop is not reachable" 208 times (reported in #1585, which was closed in the
three-day sweep and still reproduces on
ffa80d73). Nine kernels end anif constexprbranch withreturnorcontinueand run their plain path after it. In every instantiation that takes the branch, the plain path is deadcode, and nvcc warns once per instantiation:
native_bf16.cubf16_f32_mmvf_rows_kernelTSnative_mmvq.cunative_mmvq_multi_kernelTSfused_gr.cugr_down_v3_kernelRB && R2V > 1iq_kernels.cus26_gu_l_kernel,s26_down_l_kernel,s27_gu_kernel,s27_down_kernelTSiq_kernels.cunative_gu_lds_kernelTIdflash2.cugemm8_kernel!COMPUTEAfter this change the same build prints no #128-D, and the generated code is unchanged.
Related discussion
#1585 (closed by the stale sweep, not fixed). This is a focused fix with no change in behavior.
Approach
Each plain path moves into the branch's
else, so it is no longer instantiated where it cannot run. Thereturnorcontinuethat ended the branch goes away, because theelsenow reaches the same end of the function or loopbody.
gemm8_kerneltested its template parameter with a plainif (!COMPUTE); that becomesif constexpr.The bodies keep their indentation, the way
native_bf16.cualready wraps its plain loop at lines 182-196, so the diffis only the branch structure: 19 lines in 5 files, identical with
git diff -w.Validation
Linux x86-64, RTX 4090 (sm_89), CUDA 13.4.92, host GCC 15.2.0, the engine build's own nvcc command lines
(
-O3 --use_fast_math --generate-code=arch=compute_89,code=[compute_89,sm_89]) onffa80d73.Passed:
ffa80d73gives 208 #128-Dwarnings, all at these nine places (fused_gr 16, native_mmvq 147, native_bf16 32, iq_kernels 11, dflash2 2).
The other warnings in those files are unchanged (#550
dflash2.cu:775, #20199iq_kernels.cu:3840, #20058iq_kernels.cu:5583).cuobjdump -sassof each object before and after (anonymous-namespace names normalized, sincethey hash the source path) is byte-identical for all 1917 kernels: native_bf16 128, native_mmvq 1005,
fused_gr 211, dflash2 83, iq_kernels 490.
Failed:
none observed
Not run:
backend-specific code, but I have no AMD or Intel GPU toolchain here to compile it.
Limits
Only #128-D is addressed. The build's other warnings (#63 shift count in
qsa_select.cu:2501, #20280 ins2_expert_grouped.cu, #611, #550, #20199, #20058) are separate problems.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.