rich7420 commented on code in PR #677:
URL: https://github.com/apache/mahout/pull/677#discussion_r2589364842
##########
qdp/qdp-kernels/src/amplitude.cu:
##########
@@ -14,17 +14,27 @@
#include <cuda_runtime.h>
#include <cuComplex.h>
+__global__ void amplitude_encode_kernel(
+ const double* __restrict__ input,
+ cuDoubleComplex* __restrict__ state,
+ size_t input_len,
+ size_t state_len,
+ double norm
+) {
+ size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
+ if (idx >= state_len) return;
+
+ double real_part = 0.0;
+ if (idx < input_len) {
+ real_part = input[idx] / norm;
Review Comment:
I think maybe we could replace slow division (/) with fast multiplication
(*).
The logic looks solid. To maximize bandwidth on RTX cards, I suggest we
optimize it by replacing the division with multiplication and using double2 for
vectorized memory access.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]