Repository navigation
Open
Description
What happened?
When trying to run/benchmark Llama 3 8B TP8, I hit a memory access fault error:
Memory access fault by GPU node-3 (Agent handle: 0x55c1f43b9a30) on address 0x7f9768000000. Reason: Unknown.
Aborted (core dumped)
Steps to reproduce your issue
- Download IR:
wget https://sharkpublic.blob.core.windows.net/sharkpublic/halo-models/llm-dev/llama3_8b/llama3_8b_tp8.mlir
- Compile command:
../iree-build-no-trace/tools/iree-compile \
../shark-ai/llama3_8b_tp8.mlir \
--iree-hip-target=gfx942 \
--iree-hal-target-device=hip[0] \
--iree-hal-target-device=hip[1] \
--iree-hal-target-device=hip[2] \
--iree-hal-target-device=hip[3] \
--iree-hal-target-device=hip[4] \
--iree-hal-target-device=hip[5] \
--iree-hal-target-device=hip[6] \
--iree-hal-target-device=hip[7] \
-o=llama3_8b_tp8.vmfb
- Benchmark command:
ROCR_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
../iree-build-no-trace/tools/iree-benchmark-module \
--hip_use_streams=true \
--module=llama3_8b_tp8.vmfb \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank0.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank1.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank2.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank3.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank4.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank5.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank6.irpa \
--parameters=model=/shark-dev/8b/instruct/weights/tp8/llama3.1_8b_instruct_fp16_tp8.rank7.irpa \
--device=hip://0 \
--device=hip://1 \
--device=hip://2 \
--device=hip://3 \
--device=hip://4 \
--device=hip://5 \
--device=hip://6 \
--device=hip://7 \
--function=prefill_bs4 \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/tokens.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/seq_lens.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/seq_block_ids.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_0.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_1.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_2.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_3.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_4.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_5.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_6.npy \
--input=@/shark-dev/8b/prefill_args_bs4_128_stride_32_tp8/cs_f16_shard_7.npy \
--benchmark_repetitions=3
- See error:
Memory access fault by GPU node-3 (Agent handle: 0x55c1f43b9a30) on address 0x7f9768000000. Reason: Unknown.
Aborted (core dumped)
What component(s) does this issue relate to?
Runtime
Version information
Additional context
No response
Activity
renxida commentedon Mar 28, 2025
Encountered a similar issue.
Fault on trying to run
llama3.1 8b TP2 BS=1
However, changing BS to 4 causes the fault to disappear.
Self-assigning this. Will prioritize this after I bump iree in shark-ai & get shortfin tracy tracing to integrate with iree tracing.
Alex-Vasile commentedon Apr 3, 2025
Bisected this to 034bc30 (#20114).
Definitely need the multi-device tests from #19995.
Alex-Vasile commentedon Apr 3, 2025
I tracked it down a little further and am included two STREAM-level MLIRs. They both do the same operation (token imbedding, 1st attention layer, and output ops) from 8b llama using TP=1 and pipeline parallelism=2.
Token embedding and 1st layer happen in first pipeline and output ops happen in 2nd pipeline.
The working MLIR works pre- and post- the above PR. It uses devices 0 and 1 for the pipelines. While the failing MLIR uses devices 2 and 3.
Alex-Vasile commentedon Apr 7, 2025
Issues appears to be that
iree_hal_hip_device_createdoes not receive a correctdevice_count. So, the computation (iree_hal_hip_device_enable_peering) that used to be performed (as long asstatuswas okay) is now never being done.[hip] Re-enable peering for compatible devices.
[hip] Re-enable peering for compatible devices. (#20481)
Alex-Vasile commentedon Apr 8, 2025
#20481 re-enabled peering which gets the models running again. However there are still underlying issues still need to be addressed. The devices shouldn't need peering, the sharding is supposed to introduce explicit transfers wherever needed. One (or more) of the tensors are placed on the wrong devices, or something in the compile process is placing or expecting tensors on the wrong devices (e.g. #20427).
[hip] Re-enable peering for compatible devices. (#20481)