Skip to content

Llama 3 8B TP8 memory access fault #20409

Open

Description

@aviator19941

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

  1. Download IR:
wget https://sharkpublic.blob.core.windows.net/sharkpublic/halo-models/llm-dev/llama3_8b/llama3_8b_tp8.mlir
  1. 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
  1. 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
  1. 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

5c7c1f2

Additional context

No response

Activity

  1. added
    bug 🐞
    on Mar 27, 2025
  2. renxida commented on Mar 28, 2025

    @renxida
    Contributor

    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.

  3. self-assigned this
    on Mar 28, 2025
  4. Alex-Vasile commented on Apr 3, 2025

    @Alex-Vasile
    Contributor

    Bisected this to 034bc30 (#20114).

    Definitely need the multi-device tests from #19995.

  5. added
    runtime
    on Apr 3, 2025
  6. Alex-Vasile commented on Apr 3, 2025

    @Alex-Vasile
    Contributor

    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.

  7. Alex-Vasile commented on Apr 7, 2025

    @Alex-Vasile
    Contributor

    Issues appears to be that iree_hal_hip_device_create does not receive a correct device_count. So, the computation (iree_hal_hip_device_enable_peering) that used to be performed (as long as status was okay) is now never being done.

  8. Alex-Vasile commented on Apr 8, 2025

    @Alex-Vasile
    Contributor

    #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).

  9. removed their assignment
    on Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions