Skip to content

Release inputs before closing the session. - #3004

Merged
hanhanW merged 2 commits into
iree-org:mainfrom
hanhanW:fix-2948
Aug 27, 2020
Merged

hanhanW merged 2 commits into
iree-org:mainfrom
hanhanW:fix-2948

Conversation

@hanhanW

@hanhanW hanhanW commented Aug 26, 2020

Copy link
Copy Markdown
Contributor

Also fixed the test command.

Fixes #2948

Also fixed the test command.

Fixes iree-org#2948
Comment thread iree/tools/test/simple.mlir Outdated
// RUN: iree-translate --iree-hal-target-backends=vmla -iree-mlir-to-vm-bytecode-module %s -o ${TEST_TMPDIR?}/bc.module && iree-benchmark-module --driver=vmla --entry_function=abs --inputs="i32=-2" --input_file=${TEST_TMPDIR?}/bc.module

// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-translate --iree-hal-target-backends=vmla -iree-mlir-to-vm-bytecode-module %s -o ${TEST_TMPDIR?}/bc.module && iree-benchmark-module --driver=vmla --entry_function=abs --inputs="i32=-2" --input_file=${TEST_TMPDIR?}/bc.module)
// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-translate --iree-hal-target-backends=vulkan-spirv -iree-mlir-to-vm-bytecode-module %s -o ${TEST_TMPDIR?}/bc.module && iree-benchmark-module --driver=vulkan --entry_function=abs --inputs="i32=-2" --input_file=${TEST_TMPDIR?}/bc.module)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, nice catch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was trying to add a test and found this. :p

iree_allocator_system()));
}

inputs.reset();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we similarly be releasing outputs in the scopes above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think outputs is released when existing the for-loop because it's a local variable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, but this has to happen before the iree_*_release calls?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Otherwise, the allocator will be destroyed before the buffer.

@hanhanW

hanhanW commented Aug 26, 2020

Copy link
Copy Markdown
Contributor Author

This only address the issue for real GPU, but not swiftshader.

Will hit another error when creating driver and device for vulkan even with #2800

I ../iree/tools/vm_util.cc:227] 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:298] Created Vulkan Device: SwiftShader Device (LLVM 7.0.1)
[vk_mem_alloc.h : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=0, AllocationCount=1, Size=4
[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=0, AllocationCount=1, Size=4
[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 : 16824] RAW: vmaCreateBuffer
[vk_mem_alloc.h : 14433] RAW:   AllocateMemory: MemoryTypeIndex=0, AllocationCount=1, Size=4
[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 : 15787] RAW: vmaDestroyAllocator
I ../iree/tools/vm_util.cc:227] 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
/usr/local/google/home/hanchung/test_github/iree/third_party/swiftshader/src/Vulkan/libVulkan.cpp:785 vkCreateDevice TRACE_ASSERT: pCreateInfo->pNext sType = 1000207000

@hanhanW

hanhanW commented Aug 26, 2020

Copy link
Copy Markdown
Contributor Author

The error is different from kokoro, I think the reason is that I'm building with Debug and kokoro built IREE with FastBuild.

@hanhanW

hanhanW commented Aug 26, 2020

Copy link
Copy Markdown
Contributor Author

Filed another issue to track the bug in SwiftShader. I think we can disable the test for now, and unblock for benchmarking on real GPU.

@hanhanW
hanhanW merged commit b022e70 into iree-org:main Aug 27, 2020
@hanhanW
hanhanW deleted the fix-2948 branch August 27, 2020 04:31
@rsuderman rsuderman mentioned this pull request Aug 27, 2020
copybara-service Bot pushed a commit that referenced this pull request Aug 27, 2020
* aa8d1c0 Enable simple.mlir test for iree-benchmark-module on vulkan (#3016)
* 6db4e7b [vulkan] Release timepoint fences more aggressively when possible (#2800)
* a1365d3 [vulkan] Do not request timeline semaphore if not available (#2904)
* a38c890 Add more type support to model builder matmul benchmark. (#2977)
* a293ca7 Fix hyperlink to getting started docs on python page. (#3015)
* b022e70 Release inputs before closing the session. (#3004)
* f1678df Dynamicly register benchmark for entry_function with name BM_{entry_function} ..
* 6282700 Expand the tf_module_to_compiler_module API (#3009)
* f7e561a Merge pull request #3006 from rsuderman/google-to-main
* 8341d71 Explicitly insert dialects in conversion passes (#3002)
* b7c2b60 Fix format by changing to LLVM style (#3008)
* 4286f17 Merge branch 'main' into google-to-main
* f0a07f6 Allow iree.placeholder as an op between splittable ops. (#2999)
* 6bd3b1d Use hidden visibility for all symbols by default (#2997)
* d650082 VMLA Dynamic Iota support with Shape dialect work. (#2965)
* c724ee4 Add function to hide SavedModel roundtrip (#2995)
* 2fedce6 Merge pull request #2996
* c5f7030 Merge branch 'main' into google-to-main
* cf3211d [vulkan] Reset TimePointFence status when releasing back to pool (#2905)
* ebc6a83 Add lint action to check for tabs (#2984)
* 932339c Merge pull request #2964 from silvasean/add-dynamic-dot-example
* df727ae Integrate MLIR-EmitC at iml130/mlir-emitc@560cd8c (#2990)
* e824d36 Refactor for explicit dialect registration (#2978)
* 38b7d2c Allow ModelRunner to receive an array of extra symbols available during JITing..
* 264a97d Fuse linalg.tensor_reshape operations with hal.interface* operations. (#2973)
* 0e3c737 Fold flow.tensor.update when all operands are constant (#2982)
* c7a21c2 Merge pull request #2983 from rsuderman/google-to-main
* fd55a86 Add a dynamically shaped mhlo.dot lowering example

COPYBARA_INTEGRATE_REVIEW=#3018 from rsuderman:main-to-google 4a9ea02
PiperOrigin-RevId: 328784816
This was referenced Aug 27, 2020
copybara-service Bot pushed a commit that referenced this pull request Aug 27, 2020
* 0c97a1c Merge pull request #3022 from rsuderman/google-to-main
* bf264f4 Merge branch 'main' into google-to-main
* 8524cb9 Split LLVM targets into subfolders to support CMake filtering. (#2960)
* 6e78211 Fixed Emulator Timeline Semaphore parameter name (#3019)
* aa8d1c0 Enable simple.mlir test for iree-benchmark-module on vulkan (#3016)
* 6db4e7b [vulkan] Release timepoint fences more aggressively when possible (#2800)
* a1365d3 [vulkan] Do not request timeline semaphore if not available (#2904)
* a38c890 Add more type support to model builder matmul benchmark. (#2977)
* a293ca7 Fix hyperlink to getting started docs on python page. (#3015)
* b022e70 Release inputs before closing the session. (#3004)
* f1678df Dynamicly register benchmark for entry_function with name BM_{entry_function} ..
* 6282700 Expand the tf_module_to_compiler_module API (#3009)
* f7e561a Merge pull request #3006 from rsuderman/google-to-main
* 8341d71 Explicitly insert dialects in conversion passes (#3002)
* b7c2b60 Fix format by changing to LLVM style (#3008)
* 4286f17 Merge branch 'main' into google-to-main
* f0a07f6 Allow iree.placeholder as an op between splittable ops. (#2999)
* 6bd3b1d Use hidden visibility for all symbols by default (#2997)
* d650082 VMLA Dynamic Iota support with Shape dialect work. (#2965)
* c724ee4 Add function to hide SavedModel roundtrip (#2995)
* 2fedce6 Merge pull request #2996
* c5f7030 Merge branch 'main' into google-to-main
* cf3211d [vulkan] Reset TimePointFence status when releasing back to pool (#2905)
* ebc6a83 Add lint action to check for tabs (#2984)
* 932339c Merge pull request #2964 from silvasean/add-dynamic-dot-example
* df727ae Integrate MLIR-EmitC at iml130/mlir-emitc@560cd8c (#2990)
* e824d36 Refactor for explicit dialect registration (#2978)
* 38b7d2c Allow ModelRunner to receive an array of extra symbols available during JITing..
* 264a97d Fuse linalg.tensor_reshape operations with hal.interface* operations. (#2973)
* 0e3c737 Fold flow.tensor.update when all operands are constant (#2982)
* c7a21c2 Merge pull request #2983 from rsuderman/google-to-main
* fd55a86 Add a dynamically shaped mhlo.dot lowering example

COPYBARA_INTEGRATE_REVIEW=#3025 from rsuderman:main-to-google 0c97a1c
PiperOrigin-RevId: 328804964
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[vulkan] Failed: Some allocations were not freed before destruction of this memory block

3 participants