Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] RuntimeError: CUDA error: an illegal memory access was encountered with batch_size>=1 #16

Open
weixuansun opened this issue Mar 6, 2025 · 2 comments

Comments

@weixuansun
Copy link

I encountered illegal memory access issue when batch_size>=1 using NSA compression.
I have checked the code and guess the issue is from the ptr position of k and v:

p_k = tl.make_block_ptr(k + (bos * H + i_h) * K, (K, TC), (1, H*K), (0, i_c), (BK, BC), (0, 1))

I haven't dive in the code too much , but here is a possible fix:

bos_k, eos_k = i_b * TC, i_b * TC + TC
p_k = tl.make_block_ptr(k + (bos_k * H + i_h) * K, (K, TC), (1, H*K), (0, i_c), (BK, BC), (0, 1))

@weixuansun weixuansun changed the title RuntimeError: CUDA error: an illegal memory access was encountered with batch_size>=1 [Bug] RuntimeError: CUDA error: an illegal memory access was encountered with batch_size>=1 Mar 6, 2025
@ChloeL19
Copy link

Hi, is this in any way related to the following error message?

ValueError: Pointer argument (at 0) cannot be accessed from Triton (cpu tensor?)

@ChloeL19
Copy link

In any event, I tried applying the fix @weixuansun suggested, and the unit tests for test_nsa_with_compression still seem to fail with CUDA illegal memory access errors

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

No branches or pull requests

2 participants