Skip to content

Compilation of JAX model fails in Stream Execution passes #13459

Closed

Description

@rsuderman

Compile the following pass (preferably on cuda)

https://gist.githubusercontent.com/silvasean/28f8dc8bf8afbe4c150d33d494e65339/raw

Compilation causes failure when performing ScheduleExecution and ScheduleConcurrency.

Activity

  1. rsuderman commented on May 8, 2023

    @rsuderman
    CollaboratorAuthor

    I attempted to dump the IR immediately prior to both passes however segfaults occur when attempting to print prior to each of the passes.

  2. allieculp commented on May 8, 2023

    @allieculp

    @benvanik can you help triage?

  3. ScottTodd commented on May 8, 2023

    @ScottTodd
    Member

    Got a stack trace or error logs, @rsuderman ?

  4. rsuderman commented on May 9, 2023

    @rsuderman
    CollaboratorAuthor

    Inlining the stack trace. It appears that the previous pass generates illegal IR

     #0 0x00007f83fa3b17b7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x59b17b7)
     #1 0x00007f83fa3af7be llvm::sys::RunSignalHandlers() (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x59af7be)
     #2 0x00007f83fa3b1e3a SignalHandler(int) Signals.cpp:0:0
     #3 0x00007f83f445af90 (/lib/x86_64-linux-gnu/libc.so.6+0x3bf90)
     #4 0x00007f83f7b2d144 mlir::AsmPrinter::Impl::printTypeImpl(mlir::Type) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x312d144)
     #5 0x00007f83f7b28a24 mlir::OpAsmPrinter::printFunctionalType(mlir::Operation*) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3128a24)
     #6 0x00007f83f7b35f4a (anonymous namespace)::OperationPrinter::printGenericOp(mlir::Operation*, bool) AsmPrinter.cpp:0:0
     #7 0x00007f83f7b3580a (anonymous namespace)::OperationPrinter::printCustomOrGenericOp(mlir::Operation*) AsmPrinter.cpp:0:0
     #8 0x00007f83f7b32a8b (anonymous namespace)::OperationPrinter::printFullOpWithIndentAndLoc(mlir::Operation*) AsmPrinter.cpp:0:0
     #9 0x00007f83f7b31161 mlir::Operation::print(llvm::raw_ostream&, mlir::AsmState&) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3131161)
    #10 0x00007f83f7b30e99 mlir::Operation::print(llvm::raw_ostream&, mlir::OpPrintingFlags const&) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3130e99)
    #11 0x00007f83f7b90ab2 mlir::Diagnostic::appendOp(mlir::Operation&, mlir::OpPrintingFlags const&) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3190ab2)
    #12 0x00007f83f7be2fce mlir::Operation::emitError(llvm::Twine const&) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x31e2fce)
    #13 0x00007f83f7be4d1c mlir::OpState::emitError(llvm::Twine const&) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x31e4d1c)
    #14 0x00007f83f76a713d mlir::func::ReturnOp::verify() (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x2ca713d)
    #15 0x00007f83f76b4c50 mlir::Op<mlir::func::ReturnOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::ZeroResults, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::HasParent<mlir::func::FuncOp>::Impl, mlir::OpTrait::OpInvariants, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::MemRefsNormalizable, mlir::OpTrait::ReturnLike, mlir::OpTrait::IsTerminator>::verifyInvariants(mlir::Operation*) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x2cb4c50)
    #16 0x00007f83f76b3d3f mlir::RegisteredOperationName::Model<mlir::func::ReturnOp>::verifyInvariants(mlir::Operation*) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x2cb3d3f)
    #17 0x00007f83f7c01119 (anonymous namespace)::OperationVerifier::verifyOperation(mlir::Operation&) Verifier.cpp:0:0
    #18 0x00007f83f7c012db (anonymous namespace)::OperationVerifier::verifyOperation(mlir::Operation&) Verifier.cpp:0:0
    #19 0x00007f83f7c00fec mlir::verify(mlir::Operation*, bool) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3200fec)
    #20 0x00007f83f7a61d20 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3061d20)
    #21 0x00007f83f7a62348 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3062348)
    #22 0x00007f83f7a6440a mlir::detail::OpToOpPassAdaptor::runOnOperationImpl(bool) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x306440a)
    #23 0x00007f83f7a61c9f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x3061c9f)
    #24 0x00007f83f7a655aa mlir::PassManager::run(mlir::Operation*) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x30655aa)
    #25 0x00007f83f4e81099 ireeCompilerInvocationPipeline (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x481099)
    #26 0x00007f83f4e7c4ec mlir::iree_compiler::runIreecMain(int, char**)::$_2::operator()(iree_compiler_source_t*) const iree_compile_lib.cc:0:0
    #27 0x00007f83f4e7c299 mlir::iree_compiler::runIreecMain(int, char**) (/usr/local/google/home/suderman/Repos/iree/build/lib/libIREECompiler.so.0+0x47c299)
    #28 0x00007f83f444618a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
    #29 0x00007f83f4446245 call_init ./csu/../csu/libc-start.c:128:20
    #30 0x00007f83f4446245 __libc_start_main ./csu/../csu/libc-start.c:368:5
    #31 0x0000000000401061 _start (tools/iree-compile+0x401061)
    
  5. allieculp commented on May 9, 2023

    @allieculp

    @benvanik This is the next task needed for our BF16 support #13370. Is this in progress?

  6. benvanik commented on May 9, 2023

    @benvanik
    Collaborator

    I'll triage this now.

  7. benvanik commented on May 9, 2023

    @benvanik
    Collaborator
  8. benvanik commented on May 10, 2023

    @benvanik
    Collaborator

    I think I found both the issue and sadness, despair, and the need for a better utility for erasing sets of ops. Should be able to have a fix in a bit.

  9. benvanik commented on May 10, 2023

    @benvanik
    Collaborator

    (I suspect we may have many latent bugs related to the same issue in the compiler and will try to squash what I can - it's proving hard to create a small reproducer for, though)

  10. benvanik commented on May 10, 2023

    @benvanik
    Collaborator

    Nevermind, there's another issue and I'm so context switched out this is going to take me a decent chunk of time to figure out.

  11. moved this from Inbox to In Progress in (Deprecated) IREEon May 11, 2023
  12. silvasean commented on May 12, 2023

    @silvasean
    Contributor

    For completeness, error here is LLVM ERROR: operation destroyed but still has uses with full error log here -- taken from this comment

  13. allieculp commented on May 15, 2023

    @allieculp

    @benvanik Any update on this one?

  14. added
    bug 🐞
    compiler/dialects
    integrations/stablehlo
    on May 15, 2023
  15. silvasean commented on May 15, 2023

    @silvasean
    Contributor

    cc @Young768 who is also hitting this

  16. stellaraccident commented on May 15, 2023

    @stellaraccident
    Collaborator

    @benvanik I have time this afternoon if it would help to pair work on the issues you're running into. If I understand better, I may also be able to help distribute load. Lmk.

  17. benvanik commented on May 15, 2023

    @benvanik
    Collaborator

    Will dig into it today. If others are hitting this does that mean there are other reproducers available, or is it with the same input?

  18. silvasean commented on May 15, 2023

    @silvasean
    Contributor

    For the moment I think these are all coming from many people running approximately the same model from the same modeling codebase, so the IR will be very similar to the original reproducer.

  19. benvanik commented on May 15, 2023

    @benvanik
    Collaborator

    Found the root cause - special case around cloned streamable ops that have uses outside of streams (here a splat that is both used by dispatches and returned from the main function).

  20. added 2 commits that reference this issue on May 15, 2023
    d6a1a2b
    88771e0
  21. added a commit that references this issue on May 15, 2023
    e401098
  22. moved this from In Progress to Done in (Deprecated) IREEon May 15, 2023
  23. added a commit that references this issue on Jul 6, 2023
    e743a5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐞compiler/dialectsintegrations/stablehlo

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions