Skip to content

Conversation

@syedshazli
Copy link

In the CUDA Coredump blog, an incorrect documentation statement is made for this kernel:

// Kernel with illegal memory access - accesses memory beyond allocated bounds
global void normalKernel(int* data, int size) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;

// This will cause illegal memory access - accessing beyond allocated memory
// We allocate 'size' elements but access up to size * 2
if (idx < size) { // Access twice the allocated size
data[idx] = idx; //
}
}

To my knowledge, this should not generate an illegal memory access, as the size allocated is fine in the source code as well. There is also an incomplete comment for data[idx] = idx; so I'm making the assumption that these comments are a mistake

I also removed the use of the phrase 'normal execution' as it can confuse readers who may think the author is referring to the execution of the kernel called 'normalKernel.' I have replaced the wording to just be 'execution.'

Signed-off-by: syedshazli <syed.abdu1818@gmail.com>
Signed-off-by: syedshazli <syed.abdu1818@gmail.com>
@syedshazli
Copy link
Author

cc @youkaichao, author of the blog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant