Skip to content

hal.fence.join: OUT_OF_RANGE; count 90 of iree_hal_fence > 32 #13543

Closed

Description

@silvasean

What happened?

Using ir19.flagfile and ir19.no_sharding.mlir, run the following commands:

iree-compile --iree-hal-target-backends=cuda --iree-input-type=mhlo --iree-hal-cuda-llvm-target-arch=sm_80 ir19.no_sharding.mlir --iree-codegen-llvmgpu-use-transform-dialect= --iree-codegen-llvmgpu-enable-transform-dialect-jit=false -o ir19.vmfb
iree-benchmark-module --function=main --module=ir19.vmfb --device=cuda --flagfile=ir19.flagfile --benchmark_repetitions=5

(The --iree-codegen-llvmgpu-use-transform-dialect= --iree-codegen-llvmgpu-enable-transform-dialect-jit=false is to work around #13419)

I see the following error:

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

(full log here)

Steps to reproduce your issue

See above

What component(s) does this issue relate to?

Runtime

Version information

iree.git @ 4d6c2b8 (I have a couple trivial local modifications, but should be unrelated to this bug)

Additional context

No response

Activity

  1. added
    bug 🐞
    on May 10, 2023
  2. silvasean commented on May 10, 2023

    @silvasean
    ContributorAuthor

    Is the solution here as simple as just bumping up the number from 32 to 128 or something like that?

  3. benvanik commented on May 11, 2023

    @benvanik
    Collaborator

    We could slightly up it as a whackamole smack - it's guarding a stack allocation though and we'd want to keep it small and special case anything larger with a heap allocation. I think the real issue is that you have 90 non-folded fences - those are (relatively) expensive and indicate some earlier stage of the pipeline being really inefficient. --compile-to=stream and post the IR and we can see if it's obvious.

  4. allieculp commented on May 11, 2023

    @allieculp

    @pavanimajety Curious if there is any update on this?

  5. silvasean commented on May 12, 2023

    @silvasean
    ContributorAuthor
  6. silvasean commented on May 12, 2023

    @silvasean
    ContributorAuthor

    For context, this is a LLM training workload. The IR structure is the forward pass, backward pass, and then optimizer updates. The forward and backward pass each have their own stablehlo.while op. In the current IR, this actually only iterates once (note sure if we fold it away, I see a ton of control flow in the --compile-to=stream IR, more than I would expect for this). In the user workload this corresponds to microbatching (see the image here).

  7. allieculp commented on May 15, 2023

    @allieculp

    @pjannaty @pavanimajety Is this being worked on by your team?

  8. pavanimajety commented on May 15, 2023

    @pavanimajety
    Contributor

    @allieculp I am taking a look, was out of office last few days.

  9. pjannaty commented on May 15, 2023

    @pjannaty
    Contributor

    Thanks, Allie and Pavani. Allie, this looks like a high-priority bug and we are gradually ramping up and don't mean to block if someone else also wants to take a look. Happy to collaborate on this as well.

  10. benvanik commented on May 15, 2023

    @benvanik
    Collaborator

    issue is FoldBlockArgumentsPattern not properly folding the duplicate block arguments. Will see if I can get that fixed.

  11. self-assigned this
    on May 15, 2023
  12. moved this from Inbox to In Progress in (Deprecated) IREEon May 15, 2023
  13. added a commit that references this issue on May 16, 2023
    93fe5d1
  14. added a commit that references this issue on May 16, 2023
    c680b64
  15. moved this from In Progress to Done in (Deprecated) IREEon May 16, 2023
  16. added a commit that references this issue on Jul 6, 2023
    ebc8cf4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug 🐞collab/nvidia

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions