Skip to content

Sliding window test failing on NVIDIA GPU #2659

Closed

Description

@antiagainst
bazel test //integrations/tensorflow/e2e:e2e_tests_sliding_window_test__tf__iree_vulkan

Output:

[ RUN      ] SlidingWindowTest.test_slidingwindow
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=9, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
2020-07-24 21:55:48.253200: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:118] None of the MLIR optimization passes are enabled (registered 1)
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=10, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11744] RAW:     Created new block Size=8388608
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=9, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11744] RAW:     Created new block Size=8388608
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=9
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=10
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=10, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=9, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
[vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=10
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=9
SystemContext driver=<pyiree.rt.binding.HalDriver object at 0x7fd750f6bf80>
INFO:tensorflow:time(__main__.SlidingWindowTest.test_slidingwindow): 0.07s
I0724 21:55:48.291506 140564544591680 test_util.py:1973] time(__main__.SlidingWindowTest.test_slidingwindow): 0.07s
[       OK ] SlidingWindowTest.test_slidingwindow
----------------------------------------------------------------------
Ran 2 tests in 2.087s

OK (skipped=1)
[vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
[vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=9
*** Received signal 11 ***
*** BEGIN MANGLED STACK TRACE ***
/usr/local/lib/python3.6/dist-packages/tensorflow/python/../libtensorflow_framework.so.2(+0x10c561d)[0x7fd759ea861d]
/lib/x86_64-linux-gnu/libc.so.6(+0x3efd0)[0x7fd7bb634fd0]
/lib/x86_64-linux-gnu/libpthread.so.0(pthread_mutex_lock+0x0)[0x7fd7bb3e0fa0]
/usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0(+0xaca5)[0x7fd658313ca5]
/usr/lib/x86_64-linux-gnu/libEGL.so.1(eglReleaseThread+0x8b)[0x7fd6f01c56fb]
/usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.0(+0x9cdb7)[0x7fd750120db7]
*** END MANGLED STACK TRACE ***

*** Begin stack trace ***
	tensorflow::CurrentStackTrace()


	pthread_mutex_lock

	eglReleaseThread

*** End stack trace ***

I haven't looked into why. Possibly a regression somewhere. See https://source.cloud.google.com/results/invocations/af857e58-a9a0-48af-a4d4-c1d273501c55/targets/iree%2Fgcp_ubuntu%2Fbazel%2Flinux%2Fx86-turing%2Fintegrations%2Fpresubmit/log for the buildbot run.

Disabling this for now to land Bazel + Cloud GPU CI check.

Activity

  1. added
    bug 🐞
    integrations
    hal/vulkan
    on Jul 24, 2020
  2. GMNGeoffrey commented on Aug 7, 2020

    @GMNGeoffrey
    Member

    We're seeing this issue in a bunch of tests running on real GPUs now: https://source.cloud.google.com/results/invocations/d5557cee-daca-4dda-8bf4-36a06ec37f9f

    Bisect indicated it was somehow caused by 6d32fe8

    Here's the failing invocation from that commit: https://source.cloud.google.com/results/invocations/11a2a936-b909-4eb1-bcd5-30377089be59/targets

    And the passing one from the commit before (7fea2dd):
    https://source.cloud.google.com/results/invocations/45bafd16-1b72-4ea4-aa29-747e7a0f6b26

    @phoenix-meadowlark investigated but can't see any relation to that change (and I can't either):

    • tensorlist_test is flaky on Vulkan, but the others seem to consistently fail (or pass in the case of the ResNet50 test).
    • The failure actually happens during (or after) TracedModuleTestCase.tearDownClass(), after all of the unit tests pass. So the failure doesn't seem semantically related to the changes made in this commit (though they still may have led to something weird happening).
    • I tried removing the features I added outside of TracedModuleTestCase individually to see if any of them are the culprit. Removing the added set_random_seed() calls and the keep_saved_model flag had no effect.

    I think this is a bug elsewhere that was tickled somehow

    @hanhanW @antiagainst @MaheshRavishankar any ideas?

  3. antiagainst commented on Aug 7, 2020

    @antiagainst
    MemberAuthor

    Thanks @phoenix-meadowlark for looking into this! Very much appreciated. I think there is a deep issue involving the TensorFlow/Python wrapping, IREE core refcount and life cycle, and GPU driver unloading. I tried to repro the issue with iree-run-module over the generated vmfb, but in vain. It works there. I will try to look deeper, but not sure how far I can go before leaving. Scott or Ben might be able to pick up if I cannot make it.

  4. hanhanW commented on Aug 7, 2020

    @hanhanW
    Contributor

    I think there are too many things get involved. I'd start with using iree-run-module, and maybe build with ASAN/MSAN config. How do we build IREE tools with ASAN/MSAN config?

  5. antiagainst commented on Aug 7, 2020

    @antiagainst
    MemberAuthor

    Good point, @hanhanW. I haven't tried ASAN/MSAN yet; it might indeed reveal something. Being able to repro without the Python layer will make it much simpler.

  6. GMNGeoffrey commented on Aug 7, 2020

    @GMNGeoffrey
    Member

    How do we build IREE tools with ASAN/MSAN config?

    --config=asan :-)

  7. hanhanW commented on Aug 8, 2020

    @hanhanW
    Contributor

    oh, so that also works with CMake. ; )

  8. GMNGeoffrey commented on Aug 8, 2020

    @GMNGeoffrey
    Member

    oh, so that also works with CMake. ; )

    Ah... no :-D

    The asan config for Bazel is here: https://github.com/google/iree/blob/main/build_tools/bazel/iree.bazelrc#L140-L159

    You could try some of those same options with cmake. The critical one is -fsanitize=address as a compilation and linking option. You probably want some of the others also. Here are the general docs: https://clang.llvm.org/docs/AddressSanitizer.html#usage

  9. benvanik commented on Aug 8, 2020

    @benvanik
    Collaborator

    Can confirm I've manually hacked in -fsanitize=address to iree_copts.cmake and had it work. Would be nice to fully support that (and have a CI run with it enabled).

  10. antiagainst commented on Aug 8, 2020

    @antiagainst
    MemberAuthor

    Yeah. Let's support them in CMake too: #2832.

  11. GMNGeoffrey commented on Aug 11, 2020

    @GMNGeoffrey
    Member

    So for now, having a failing build isn't great. How should we proceed while we diagnose this?

    1. Turn off the GPU build postsubmit.
    2. Exclude these tests from OSS build bots entirely (no swiftshader coverage).
    3. Create a new exclusion mechanism and exclude these tests only on real GPU build bots.

    3 is the right thing to do, but requires the most configuration

  12. hanhanW commented on Aug 11, 2020

    @hanhanW
    Contributor

    Would be good if we can go with (3). (2) is acceptable to me, since it still run on internal infra using swiftshader.

  13. antiagainst commented on Aug 11, 2020

    @antiagainst
    MemberAuthor

    +1 to have a more fine-grained excluding mechanism. In the meanwhile, I'm fine turning of bazel NVIDIA build. Let's don't exclude the tests entirely. Getting covered by SwiftShader guards us from seeing functionality regressions.

  14. GMNGeoffrey commented on Aug 11, 2020

    @GMNGeoffrey
    Member

    +1 to have a more fine-grained excluding mechanism. In the meanwhile, I'm fine turning of bazel NVIDIA build. Let's don't exclude the tests entirely. Getting covered by SwiftShader guards us from seeing functionality regressions.

    Ok I will turn it off for now. If someone can investigate this bug, I will investigate a finer-grained exclusion mechanism

  15. hanhanW commented on Aug 11, 2020

    @hanhanW
    Contributor

    I will investigate this bug.

  16. self-assigned this
    on Aug 11, 2020
  17. antiagainst commented on Aug 11, 2020

    @antiagainst
    MemberAuthor

    Thanks @hanhanW! I will also keep looking into this; but cannot guarantee on the effort. So having more eyes over this is certainly very helpful. I'd suggest to also cross check with #2833; they bear some similarity. (Not saying they are resulting from the same issue for sure; but if that's the case that would be awesome.)

  18. GMNGeoffrey commented on Aug 11, 2020

    @GMNGeoffrey
    Member

    Ok I have disabled the build and will look into if we can only exclude only some of the TF tests from GPU. Note that we do still have real GPU coverage for everything buildable on the cmake side.

  19. hanhanW commented on Aug 12, 2020

    @hanhanW
    Contributor

    I dumped the module file, and can't reproduce with iree-run-module.

    Tried running on SwiftShader and physical GPU. It's passing on SwiftShader. However, the order of the log looks weird to me. I think the last two logs should locate before OK or something else?

    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=0
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=0, AllocationCount=1, Size=8
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=0, AllocationCount=1, Size=24
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=0, AllocationCount=1, Size=16
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=0, AllocationCount=1, Size=8
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=0
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=0
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=0
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=0
    SystemContext driver=<pyiree.rt.binding.HalDriver object at 0x7ff6fea86bf0>
    I0812 16:04:17.683166 140703212906304 tf_test_utils.py:499] Comparing the reference backend 'tf_ref' with 'iree_vulkan'
    I0812 16:04:17.683438 140703212906304 tf_test_utils.py:227] Comparing calls to 'predict'
    I0812 16:04:17.684005 140703212906304 tf_test_utils.py:227] Comparing calls to 'predict'
    INFO:tensorflow:time(__main__.SlidingWindowTest.test_sliding_window): 0.07s
    I0812 16:04:17.688562 140703212906304 test_util.py:1969] time(__main__.SlidingWindowTest.test_sliding_window): 0.07s
    [       OK ] SlidingWindowTest.test_sliding_window
    ----------------------------------------------------------------------
    Ran 2 tests in 0.562s
    
    OK (skipped=1)
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=0
    

    ===

    Running on physical GPU with iree-run-module, we can get the log like:

    I ../iree/tools/vm_util.cc:237] Creating driver and device for 'vulkan'...
    E ../iree/hal/vulkan/debug_reporter.cc:40] libSPIRV-Tools-opt.so: cannot open shared object file: No such file or directory
    E ../iree/hal/vulkan/debug_reporter.cc:40] libSPIRV-Tools-opt.so: cannot open shared object file: No such file or directory
    [vk_mem_alloc.h : 15777] RAW: vmaCreateAllocator
    I ../iree/hal/vulkan/vulkan_driver.cc:295] Created Vulkan Device: Quadro P1000
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=9, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11744] RAW:     Created new block Size=8388608
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=10, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11744] RAW:     Created new block Size=8388608
    EXEC @predict
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=9, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11744] RAW:     Created new block Size=8388608
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=9
    I ../iree/tools/vm_util.cc:180] result[0]: Buffer<float32[1x3x2]>
    1x3x2xf32=[[0 0][0 0][3 4]]
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=10
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=9
    [vk_mem_alloc.h : 15787] RAW: vmaDestroyAllocator
    

    It seems that the second vmaDestroyBuffer to last is for output buffer, ie, result[0]: Buffer<float32[1x3x2]>. Any idea for the last buffer?

    Running with bazel, the log is:

    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=9, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=10, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11744] RAW:     Created new block Size=8388608
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=9, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11744] RAW:     Created new block Size=8388608
    [vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
    [vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=7, AllocationCount=1, Size=256
    [vk_mem_alloc.h : 11648] RAW:     Returned from existing block #0
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=7
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=9
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=10
    SystemContext driver=<pyiree.rt.binding.HalDriver object at 0x7f4aab83c0b0>
    I0812 17:43:38.695214 139959624165184 tf_test_utils.py:499] Comparing the reference backend 'tf_ref' with 'iree_vulkan'
    I0812 17:43:38.695340 139959624165184 tf_test_utils.py:227] Comparing calls to 'predict'
    INFO:tensorflow:time(__main__.SlidingWindowTest.test_sliding_window): 0.03s
    I0812 17:43:38.696591 139959624165184 test_util.py:1969] time(__main__.SlidingWindowTest.test_sliding_window): 0.03s
    [       OK ] SlidingWindowTest.test_sliding_window
    ----------------------------------------------------------------------
    Ran 2 tests in 0.831s
    
    OK (skipped=1)
    [vk_mem_alloc.h : 16934] RAW: vmaDestroyBuffer
    [vk_mem_alloc.h : 11934] RAW:   Freed from MemoryTypeIndex=9
    *** Received signal 11 ***
    *** BEGIN MANGLED STACK TRACE ***
    /usr/local/google/home/hanchung/.pyenv/versions/3.8.2/lib/python3.8/site-packages/tensorflow/python/../libtensorflow_framework.so.2(+0x108edad)[0x7f49dfdeedad]
    /lib/x86_64-linux-gnu/libc.so.6(+0x3b7e0)[0x7f4ae3c967e0]
    /lib/x86_64-linux-gnu/libpthread.so.0(__pthread_mutex_lock+0x0)[0x7f4ae3c457b0]
    /lib/x86_64-linux-gnu/libEGL_mesa.so.0(+0xafc3)[0x7f4a9ef24fc3]
    /lib/x86_64-linux-gnu/libEGL.so.1(eglReleaseThread+0x8b)[0x7f4aadf16c1b]
    /lib/x86_64-linux-gnu/libGLX_nvidia.so.0(+0x9cdb7)[0x7f49d037fdb7]
    *** END MANGLED STACK TRACE ***
    
    *** Begin stack trace ***
            tensorflow::CurrentStackTrace()
    
    
            __pthread_mutex_lock
    
            eglReleaseThread
    
    *** End stack trace ***
    

    Looks like the crashing happens in Freed from MemoryTypeIndex=9 because even in SwiftShader there is no [vk_mem_alloc.h : 15787] RAW: vmaDestroyAllocator in the end.

    Would be great if we can get more context for the last freed buffer.

  20. GMNGeoffrey commented on Aug 15, 2020

    @GMNGeoffrey
    Member

    This was fixed by #2899. There still appears to be an issue with python ref counting (#2900), but these tests are now passing and running on postsubmit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug 🐞hal/vulkanintegrations

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions