This is an automated email from the ASF dual-hosted git repository.

ryankert01 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git


The following commit(s) were added to refs/heads/main by this push:
     new b22bbdcdb perf(qdp): inline norm calculation in phase kernel loop for 
5% speedup (#1380)
b22bbdcdb is described below

commit b22bbdcdba6d0b19bc4f56b23107309b0bf41710
Author: botsz <[email protected]>
AuthorDate: Wed Jun 10 02:17:38 2026 +0800

    perf(qdp): inline norm calculation in phase kernel loop for 5% speedup 
(#1380)
    
    * perf(qdp): inline norm calculation in phase kernel loop for 5% speedup
    
    * Potential fix for pull request finding
    
    Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>
    
    * fix: remove trailing whitespace in phase.cu
    
    ---------
    
    Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>
---
 qdp/qdp-kernels/src/phase.cu | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qdp/qdp-kernels/src/phase.cu b/qdp/qdp-kernels/src/phase.cu
index d55bbe269..1ee757a04 100644
--- a/qdp/qdp-kernels/src/phase.cu
+++ b/qdp/qdp-kernels/src/phase.cu
@@ -53,13 +53,14 @@ __global__ void phase_encode_kernel(
 
     // φ(idx) = Σ_k phases[k] * b_k,  b_k = (idx >> k) & 1
     double phi = 0.0;
+    double norm = 1.0;
     for (unsigned int bit = 0; bit < num_qubits; ++bit) {
         if ((idx >> bit) & 1U) {
             phi += phases[bit];
         }
+        norm *= M_SQRT1_2;
     }
 
-    double norm = phase_norm(num_qubits);
     double re, im;
     sincos(phi, &im, &re);   // re = cos(φ), im = sin(φ)
 

Reply via email to