From b71b88dad50093bf52ff7020722f083ba89cceea Mon Sep 17 00:00:00 2001 From: KarhouTam Date: Fri, 29 Aug 2025 22:03:34 +0800 Subject: [PATCH] Fix comments to clarify variable roles in SharedMemoryReduction kernel --- lecture_009/segment_reduce.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lecture_009/segment_reduce.cu b/lecture_009/segment_reduce.cu index bf6c21f..0a49a34 100644 --- a/lecture_009/segment_reduce.cu +++ b/lecture_009/segment_reduce.cu @@ -5,8 +5,8 @@ __global__ void SharedMemoryReduction(float* input, float* output, int n) { __shared__ float input_s[BLOCK_DIM]; - unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x; // index within a block - unsigned int t = threadIdx.x; // global index + unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x; // global index + unsigned int t = threadIdx.x; // index within a block // Load elements into shared memory if (idx < n) {