You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by hc...@apache.org on 2026/06/09 18:17:43 UTC
(mahout) branch main updated: perf(qdp): inline norm calculation in phase kernel loop for 5% speedup (#1380)
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 <22...@users.noreply.github.com>
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 <17...@users.noreply.github.com>
* fix: remove trailing whitespace in phase.cu
---------
Co-authored-by: Copilot Autofix powered by AI <17...@users.noreply.github.com>
---
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(φ)