iree: codegen producing register count overflow for hip target gfx942 with 8 devices

What happened?

I’m getting a register count overflow when trying to run llama3.1_405b_fp16 for 8 HIP devices targeting gfx942 iree/runtime/src/iree/vm/bytecode/verifier.c:345: RESOURCE_EXHAUSTED; register count overflow; loading bytecode module at '405b_f16_tp8.vmfb'; loading modules and dependencies; creating run context

Steps to reproduce your issue

Using llama3.1_405b_f16_tp8.mlir obtained from the SHARK-Platform model export process Compile the mlir

iree-build/tools/iree-compile /data/llama-3.1/405b/llama3.1_405b_fp16_tp8.mlir   --iree-hal-target-device=hip[0] --iree-hal-target-device=rhip[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]   --iree-hal-executable-debug-level=3 --iree-hip-target=gfx942   -o 405b_f16_tp8.vmfb

Attempt to run the vmfb

iree-build/tools/iree-run-module --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank0.irpa" --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank1.irpa" --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank2.irpa" --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank3.irpa" --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank4.irpa" --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank5.irpa" --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank6.irpa" --parameters="model=/data/llama3.1/405b/llama3.1_405b_fp16_tp8_parameters.rank7.irpa"  --module=405b_f16_tp8.vmfb --function=prefill_bs4   --input=4x1xi64=0   --input=4xi64=1   --input=4x1xi64=0,1,2,3   --input=1x2097152xf16 --device=hip[0] --device=hip[1] --device=hip[2] --device=hip[3] --device=hip[4] --device=hip[5] --device=hip[6] --device=hip[7]

What component(s) does this issue relate to?

Compiler

Version information

3b751a4d2

Additional context

MLIR vmfb The sharded parameter files are not necessary to replicate this error but I can upload these to a private location if necessary.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 38 (7 by maintainers)

Most upvoted comments

If I understand correctly, this version might include shape assertions because it includes this patch during export. Original Flow Stream VM

A large number of dispatches in here are slow_memcpy. There are literally 15128 slow_mempy dispatches. πŸ™…πŸ™…πŸ™…πŸ™…πŸ™…πŸ™…πŸ™…πŸ™…

        %18 = flow.dispatch.tensor.load %16, offsets = [0, 0, 0], sizes = [4, %15, 128], strides = [1, 1, 1] : !flow.dispatch.tensor<readonly:tensor<4x?x128xf16>>{%15} -> tensor<4x?x128xf16>
        flow.dispatch.tensor.store %18, %17, offsets = [0, 0, 0, 0], sizes = [4, %15, 1, 128], strides = [1, 1, 1, 1] : tensor<4x?x128xf16> -> !flow.dispatch.tensor<readwrite:tensor<4x?x1x128xf16>>{%15}

looks like most are just adding a unit dimension.

Ah, I found my mistake. I thought --compile-to=vm would produce the vmfb, but it seems it is one step before it. Tried compiled the rest of the way, but the compiler just seems to be crashing with this error:

LLVM ERROR: can't create Attribute 'mlir::iree_compiler::IREE::GPU::MMAIntrinsicAttr' because storage uniquer isn't initialized: the dialect was likely not loaded, or the attribute wasn't added with addAttributes<...>() in the Dialect::initialize() method.

Yeah, that’s what I meant… Need to partition on some axis