You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve memory allocation for LLM-like models #13545
iree/runtime/src/iree/hal/drivers/cuda/cuda_device.c:538: INTERNAL; CUDA driver error 'CUDA_ERROR_ILLEGAL_ADDRESS' (700):
an illegal memory access was encountered; cuStreamSynchronize; while invoking native function hal.device.queue.execute;
while calling import;
If I comment out the cuStreamSynchronize then the error gets attributed to:
iree/runtime/src/iree/hal/drivers/cuda/stream_command_buffer.c:507: INTERNAL; CUDA driver error 'CUDA_ERROR_ILLEGAL_ADDRESS' (700): an illegal memory access was encountered; cuLaunchKernel; while invoking native function hal.device.queue.execute; while calling import;
It looks like it is likely due to running out of memory. It would be nice if we could diagnose this better. I will try a smaller variant of this model. However, it is important to note that this model runs successfully on XLA:GPU with the available memory (A100-40GB), so perhaps we can use this bug to guide improvements to our memory allocation strategy. I renamed the bug to reflect that.
Also if this is IREE's OOM failure mode, we should try to improve this, as it is really non-obvious. XLA:GPU gives a detailed diagnosis listing the buffers involved in the OOM situation and their sizes and names.
@silvasean I tried to repro the issue with the latest iree commit and I get LLVM ERROR: operation destroyed but still has uses while creating the vmfb file. Any ideas what might have I done wrong?
That looks like the thing that Sean was working around by disabling the transform dialect for CUDA. I can't find the issue right now, but it is waiting until next week for the owner of the component to return from vacation.
Activity
silvasean commentedon May 10, 2023
If I comment out the cuStreamSynchronize then the error gets attributed to:
silvasean commentedon May 10, 2023
I suspect that this is due to a miscompile. Can somebody confirm that that is what this likely means? I will bisect it tomorrow.
silvasean commentedon May 10, 2023
It looks like it is likely due to running out of memory. It would be nice if we could diagnose this better. I will try a smaller variant of this model. However, it is important to note that this model runs successfully on XLA:GPU with the available memory (A100-40GB), so perhaps we can use this bug to guide improvements to our memory allocation strategy. I renamed the bug to reflect that.
silvasean commentedon May 10, 2023
I tried with
--device_allocator=cachingand got the same error.[-]cuStreamSynchronize: CUDA_ERROR_ILLEGAL_ADDRESS[/-][+][CUDA] Improve memory allocation[/+]silvasean commentedon May 11, 2023
Also if this is IREE's OOM failure mode, we should try to improve this, as it is really non-obvious. XLA:GPU gives a detailed diagnosis listing the buffers involved in the OOM situation and their sizes and names.
kushanam commentedon May 11, 2023
@silvasean I tried to repro the issue with the latest iree commit and I get
LLVM ERROR: operation destroyed but still has useswhile creating the vmfb file. Any ideas what might have I done wrong?stellaraccident commentedon May 12, 2023
That looks like the thing that Sean was working around by disabling the transform dialect for CUDA. I can't find the issue right now, but it is waiting until next week for the owner of the component to return from vacation.
stellaraccident commentedon May 12, 2023
This one, I think: #13419
kushanam commentedon May 12, 2023
Thank you @stellaraccident!
kushanam commentedon May 12, 2023
@stellaraccident seems like I already tried the workaround which is also in the linked issue. Still getting the same error.
silvasean commentedon May 12, 2023
That is a separate issue tracked here: #13459
I don't know why I am not hitting it in my particular setup.
65 remaining items
Enable multi-use fusion for cases where the shapes of the two ops are…
Enable multi-use fusion for cases where the shapes of the two ops are…
Create dispatches for scalar computation using program slices. (iree-…
Improving iree-stream-emplace-allocations pass. (iree-org#13732)
Switching to --iree-stream-partitioning-favor=min-peak-memory. (iree-…
Properly marking stream alloca ops as non-pure and expanding folding. (…
Enable multi-use fusion for cases where the shapes of the two ops are…
Enable multi-use fusion for cases where the shapes of the two ops are…
Improving iree-stream-emplace-allocations pass. (iree-org#13732)
Switching to --iree-stream-partitioning-favor=min-peak-memory. (iree-…
Properly marking stream alloca ops as non-pure and expanding folding. (…
Create dispatches for scalar computation using program slices. (iree-…
Enable multi-use fusion for cases where the shapes of the two ops are…