Repository navigation
Closed
Labels
hal/vulkanRuntime Vulkan GPU HAL backend
Description
With #5264 Mobilebert was changed to run as well in CI (there was a missing iree.symbol.export that prevented it). With this, the CPU side runs fine, but the GPU/Vulkan-SPIRV side fails to run. With the old path I get this error
$ ../build-vulkan-tracy/iree/tools/iree-run-mlir -export-all -iree-hal-target-backends=vulkan-spirv ../iree/iree/test/e2e/models/bert_encoder_unrolled_fake_weights.mlir
I /home/ravishankarm/Development/iree/iree/iree/tools/iree-run-mlir-main.cc:205] Compiling for target backend 'vulkan-spirv*'...
I /home/ravishankarm/Development/iree/iree/iree/tools/iree-run-mlir-main.cc:318] Evaluating all functions in module for driver 'vulkan'...
I /home/ravishankarm/Development/iree/iree/iree/tools/utils/vm_util.cc:258] Creating driver and device for 'vulkan'...
EXEC @serving_default
E /home/ravishankarm/Development/iree/iree/iree/tools/iree-run-mlir-main.cc:469] Failure for split at line #1: /home/ravishankarm/Development/iree/iree/iree/hal/vulkan/status_util.c:53: RESOURCE_EXHAUSTED; VK_ERROR_OUT_OF_DEVICE_MEMORY; vmaCreateBuffer; while invoking native function hal.allocator.allocate; while calling import; Evaluating export function 2; Evaluating functions
ERROR running file (../iree/iree/test/e2e/models/bert_encoder_unrolled_fake_weights.mlir): /home/ravishankarm/Development/iree/iree/iree/hal/vulkan/status_util.c:53: RESOURCE_EXHAUSTED; VK_ERROR_OUT_OF_DEVICE_MEMORY; vmaCreateBuffer; while invoking native function hal.allocator.allocate; while calling import; Evaluating export function 2; Evaluating functions
pure virtual method called
terminate called without an active exception
Aborted
with the new path I get this error
../build-vulkan-tracy/iree/tools/iree-run-mlir -export-all -iree-hal-target-backends=vulkan-spirv -iree-flow-dispatch-linalg-on-tensors -iree-codegen-spirv-experimental-linalg-on-tensors ../iree/iree/test/e2e/models/bert_encoder_unrolled_fake_weights.mlir
I /home/ravishankarm/Development/iree/iree/iree/tools/iree-run-mlir-main.cc:205] Compiling for target backend 'vulkan-spirv*'...
I /home/ravishankarm/Development/iree/iree/iree/tools/iree-run-mlir-main.cc:318] Evaluating all functions in module for driver 'vulkan'...
I /home/ravishankarm/Development/iree/iree/iree/tools/utils/vm_util.cc:258] Creating driver and device for 'vulkan'...
EXEC @serving_default
E /home/ravishankarm/Development/iree/iree/iree/tools/iree-run-mlir-main.cc:469] Failure for split at line #1: /home/ravishankarm/Development/iree/iree/iree/hal/vulkan/status_util.c:53: RESOURCE_EXHAUSTED; VK_ERROR_OUT_OF_DEVICE_MEMORY; vmaCreateBuffer; while invoking native function hal.allocator.allocate; while calling import; Evaluating export function 2; Evaluating functions
ERROR running file (../iree/iree/test/e2e/models/bert_encoder_unrolled_fake_weights.mlir): /home/ravishankarm/Development/iree/iree/iree/hal/vulkan/status_util.c:53: RESOURCE_EXHAUSTED; VK_ERROR_OUT_OF_DEVICE_MEMORY; vmaCreateBuffer; while invoking native function hal.allocator.allocate; while calling import; Evaluating export function 2; Evaluating functions
free(): double free detected in tcache 2
pure virtual method called
terminate called without an active exception
Aborted
Seems to be different errors.
Metadata
Metadata
Assignees
Labels
hal/vulkanRuntime Vulkan GPU HAL backend
Activity
Disable running BERT on Vulkan (see Issue iree-org#5268)
ThomasRaoux commentedon Mar 31, 2021
This seems to pass on Android after Mahesh enabled it to run:
https://buildkite.com/iree/iree-android-arm64-v8a/builds/3873#f314defd-3437-45cd-9c10-066fecd3ef51
So the failure is only seen on Nvida GPUs so far.
Disable running BERT on Vulkan (see Issue #5268) (#5269)
MaheshRavishankar commentedon Mar 31, 2021
In any case. It is disabled for all GPUs (I am happy to turn it back on if there is a way to avoid running this just on NVIDIA hardware)
hanhanW commentedon Apr 1, 2021
Probably related to #5162
ThomasRaoux commentedon Apr 1, 2021
This is related to running several tests in parallel right? This happens locally for me just running this single test.
hanhanW commentedon Apr 1, 2021
oh I see. I didn't notice that it's run manually with
iree-run-mlir, sorry.antiagainst commentedon Apr 1, 2021
Started to look into this.
antiagainst commentedon Apr 2, 2021
Looks it's because we are always allocating memory with both
DIVICE_LOCAL_BITandHOST_VISIBLE_BIT. TheHOST_VISIBLE_BITmeans a special heap with limited total size and we are exceeding that. For example, on my local RTX 2070 Super, where I can repro this issue,vulkaninfogives the following:A simple
export VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_api_dumpshows that we are always allocating memory withmemoryTypeIndex = 10, which usesmemoryHeaps[2]. We only have 246MB there.. I don't know the heap status for Tesla T4 used for our CI, but I think it might be something similar.This is passing for Android because we have unified memory there. So
DEVICE_LOCAL_BITandHOST_VISIBLE_BITis available for the whole memory, e.g., for Mali G77.Looking into the HAL code, it seems we have a TODO here, which forces
HOST_VISIBLE_BITon:https://github.com/google/iree/blob/1386d2cd284bf8babafdf90a0823afabd0e0c9f8/iree/hal/vulkan/vma_allocator.cc#L158-L169
@benvanik: looks like we can just delete the above?
antiagainst commentedon Apr 2, 2021
Yeah, I can confirm that after deleting L166-L167 in the above, the test passes.
benvanik commentedon Apr 2, 2021
awesome - good find! we may be able to get rid of the host visible/mapping bit soon (if not already) - part of the reason for it was hal.buffer.fill and such, but now those are all command buffer operations and don't require host-visible memory. lots of GPUs have limits on that memory type because they are limited to the PCI-E aperture size.
benvanik commentedon Apr 2, 2021
Ah nevermind with BufferLoadOp we may still need this for now - both HAL_BufferFillOp and HAL_BufferCopyOp can be removed though. We need the analysis to know that a particular buffer is read back on the host to set the right bit (which is the same analysis I need for allocation). We could at least ensure we aren't setting it for constants and such.
benvanik commentedon Apr 2, 2021
(detensoring would also help - it's used now for those silly tensor loop iterators)
1 remaining item
Merge main -> google
GMNGeoffrey commentedon Apr 6, 2021
We're having the same issue with
large_cifar10_tests__applications__iree_vulkan__model__ResNet50: https://source.cloud.google.com/results/invocations/ad178b26-b4a9-4ec4-9aa8-80e41e43a8f1/targets/iree%2Fgcp_ubuntu%2Fcmake-bazel%2Flinux%2Fx86-turing%2Fmain/log[vulkan] Disable ResNet50 test failing on NVIDIA GPUs
antiagainst commentedon Apr 7, 2021
I've my hands full with a few other bugs to fix. For now I'll disable the ResNet50 test to avoid hiding other potential failures. I'll come back to this after addressing the other issues, if Ben didn't solve it before I can. :)
[-]MobileBERT (fake weights) fails to run on Vulkan[/-][+]Always requiring HOST_VISIBLE memory causes out of memory on NVIDIA GPU[/+][vulkan] Disable ResNet50 test failing on NVIDIA GPUs
benvanik commentedon Apr 7, 2021
After #5328 lands I can take a look at this. Doing the buffer tracking to know when a readback is required (and thus HOST_VISIBLE must be set) is a good next step for buffer allocation.
[vulkan] Disable ResNet50 test failing on NVIDIA GPUs (#5332)
Revert "Disable running BERT on Vulkan (see Issue #5268) (#5269)"
Merge pull request #5357 from google/benvanik-host-visible
Merge main -> google
Merge main -> google