Skip to content

OUT_OF_RANGE while invoking hal.fence.join for non-tiny model training #10903

Closed

Description

@phoenix-meadowlark

What happened?

iree-run-module throws an OUT_OF_RANGE error when executing the training step for models which train more than ~32 variables. For example, when attempting to execute training for a model with 36 variables the following error is thrown:

iree/runtime/src/iree/modules/hal/module.c:1038:
  OUT_OF_RANGE; count 37 of iree_hal_fence > 32; while invoking native function hal.fence.join; while calling import;

Merely updating more than ~32 variables is insufficient so I've included the whole training step in the reproducer. The count above also doesn't solely depend on the number of variables.

Steps to reproduce your issue

The error above can be reproduced using the following reproducer: out_of_range.mlir

iree-compile \
  --iree-hal-target-backends=vmvx \
  --iree-input-type=mhlo \
  /tmp/out_of_range.mlir \
  -o /tmp/out_of_range.vmfb

iree-run-module \
  --device=local-sync \
  --entry_function=train_step \
  --function_input=100x16000xi16 \
  --function_input=100x16000xf32 \
  --function_input=100xi16 \
  --module_file=/tmp/out_of_range.vmfb
EXEC @train_step
iree/runtime/src/iree/modules/hal/module.c:1038: OUT_OF_RANGE; count 37 of iree_hal_fence > 32; while invoking native function hal.fence.join; while calling import;
[ 1]   native hal.fence.join:0 -
[ 0] bytecode hotword.train_step:4038 [
  ]
      at /tmp/out_of_range.mlir:75:14
      at /tmp/out_of_range.mlir:38:3; invoking function 'train_step'

What component(s) does this issue relate to?

Runtime

Version information

cfedd31

Additional context

No response

Activity

  1. added
    bug 🐞
    runtime
    hal/api
    on Oct 25, 2022
  2. added this to the milestone on Oct 25, 2022
  3. self-assigned this
    on Oct 25, 2022
  4. moved this to Not Started in IREEon Oct 25, 2022
  5. benvanik commented on Oct 25, 2022

    @benvanik
    Collaborator

    Interesting that these don't get coalesced - I suspect maybe the missing IPO step across an internal function call boundary. Will take a look.

  6. added
    compiler/dialects
    and removed
    runtime
    hal/api
    on Oct 25, 2022
  7. benvanik commented on Oct 25, 2022

    @benvanik
    Collaborator

    (interesting stuff in this model - lots of opportunities for dispatch formation improvements - seeing a lot of tensor->tensor dispatches that could be merged)

  8. benvanik commented on Oct 25, 2022

    @benvanik
    Collaborator

    (nevermind, dispatches are all just 1x1x1)

    And yeah, this fusion stuff is real bad:
    image

    Whenever someone looks at performance for this model this should definitely be the starting point!

  9. 4 remaining items

  10. added 2 commits that reference this issue on Oct 27, 2022
    1aece59
    ce96fb8
  11. added a commit that references this issue on Oct 27, 2022
    c3d63c1
  12. Repository owner moved this from In Progress to Done in IREEon Oct 27, 2022
  13. phoenix-meadowlark commented on Oct 27, 2022

    @phoenix-meadowlark
    ContributorAuthor

    I suspect you're running a release compiler build with assertions disabled otherwise you'd have hit that long before you hit runtime issues :)

    I've been using RelWithDebInfo – would Debug be a better option when just trying to test what is and isn't supported?

  14. ScottTodd commented on Oct 27, 2022

    @ScottTodd
    Member

    I suspect you're running a release compiler build with assertions disabled otherwise you'd have hit that long before you hit runtime issues :)

    I've been using RelWithDebInfo – would Debug be a better option when just trying to test what is and isn't supported?

    https://iree-org.github.io/iree/building-from-source/getting-started/#clone-and-build

        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DIREE_ENABLE_ASSERTIONS=ON \
    
  15. phoenix-meadowlark commented on Oct 27, 2022

    @phoenix-meadowlark
    ContributorAuthor

    I suspect you're running a release compiler build with assertions disabled otherwise you'd have hit that long before you hit runtime issues :)

    I've been using RelWithDebInfo – would Debug be a better option when just trying to test what is and isn't supported?

    https://iree-org.github.io/iree/building-from-source/getting-started/#clone-and-build

        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DIREE_ENABLE_ASSERTIONS=ON \
    

    Okay yeah that's what I've been using!

  16. benvanik commented on Oct 27, 2022

    @benvanik
    Collaborator

    Interesting - I wonder why you don't hit the same assert I am in #10915 - may be worth trying one time in Debug just to make sure the IREE_ENABLE_ASSERTIONS flag is working as it should (I only run in Debug).

  17. phoenix-meadowlark commented on Oct 27, 2022

    @phoenix-meadowlark
    ContributorAuthor

    Hmmm, I did a Debug build from scratch with IREE_ENABLE_ASSERTIONS unset and I'm not hitting any asserts when I compile out_of_range.mlir.

    In both configurations trying to execute the VMVX-compiled module causes iree-run-module to hang after printing EXEC @train_step. I actually noticed this behavior for some other modules as well, but wasn't sure if it was a bug or VMVX just being incredibly slow for some reason.

  18. benvanik commented on Oct 27, 2022

    @benvanik
    Collaborator

    VMVX is incredibly slow - try llvm-cpu :)

  19. phoenix-meadowlark commented on Oct 27, 2022

    @phoenix-meadowlark
    ContributorAuthor

    Gotcha! Training with llvm-cpu is currently blocked by #10839 so I switched to VMVX to see if I could find any other issues that might pop up down the line.

  20. benvanik commented on Oct 27, 2022

    @benvanik
    Collaborator

    Oh nice - that's a duplicate of the issue I was hitting - we should make sure @MaheshRavishankar / @hanhanW / someone codegen sees it!

  21. added a commit that references this issue on Oct 31, 2022
    7738625
  22. added a commit that references this issue on Nov 1, 2022
    fa45aa5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐞compiler/dialects

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions