Bug 102704 - vkAllocateDeviceMemory does not check memory heap size
Summary: vkAllocateDeviceMemory does not check memory heap size
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-13 12:20 UTC by Nicolas Koch
Modified: 2019-06-06 14:16 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Nicolas Koch 2017-09-13 12:20:13 UTC
So there is a vulkan wrapper called vulkano (written in rust), and one test case in particular fails on anv.

The code snippet allocates more memory than reported by vkMemoryHeap.size, but in multiple allocations. I would expect this to fail with VK_ERROR_OUT_OF_DEVICE_MEMORY, but it doesn't.

I currently only have a rust code snippet, but from the code it should be obvious what's happening under the hood:

    #[test]
    #[ignore] // TODO: test fails for now on Mesa+Intel
    fn oom_multi() {
        let (device, _) = gfx_dev_and_queue!();
        let mem_ty = device
            .physical_device()
            .memory_types()
            .filter(|m| !m.is_lazily_allocated())
            .next()
            .unwrap();
        let heap_size = mem_ty.heap().size();

        let mut allocs = Vec::new();

        for _ in 0 .. 4 {
            match DeviceMemory::alloc(device.clone(), mem_ty, heap_size / 3) {
                Err(DeviceMemoryAllocError::OomError(OomError::OutOfDeviceMemory)) => return, // test succeeded
                Ok(a) => allocs.push(a),
                _ => (),
            }
        }

        panic!()
    }
Comment 1 Danylo 2018-07-24 11:30:20 UTC
The issue was fixed some time ago, launched the test with Mesa 18.1.3 and Mesa master - test passes.
With the debug mesa next message is printed as expected:
 INTEL-MESA: error: vulkan/anv_allocator.c:1290: failed to allocate virtual address for BO (VK_ERROR_OUT_OF_DEVICE_MEMORY)
Comment 2 Denis 2019-06-06 14:16:14 UTC
according to Danylo issue was fixed. Please reopen if you can reproduce it


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.