All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.vulkan.NVExternalMemoryRdma Maven / Gradle / Ivy

Go to download

A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.

There is a newer version: 3.3.4
Show newest version
/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 * MACHINE GENERATED FILE, DO NOT EDIT
 */
package org.lwjgl.vulkan;

import org.lwjgl.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryUtil.*;

/**
 * This extension adds support for allocating memory which can be used for remote direct memory access (RDMA) from other devices.
 * 
 * 
Examples
* *

 * VkPhysicalDeviceMemoryBudgetPropertiesEXT memoryBudgetProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT };
 * VkPhysicalDeviceMemoryProperties2 memoryProperties2 = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2, &memoryBudgetProperties };
 * vkGetPhysicalDeviceMemoryProperties2(physicalDevice, &memoryProperties2);
 * uint32_t heapIndex = (uint32_t)-1;
 * for (uint32_t memoryType = 0; memoryType < memoryProperties2.memoryProperties.memoryTypeCount; memoryType++) {
 *     if (memoryProperties2.memoryProperties.memoryTypes[memoryType].propertyFlags & VK_MEMORY_PROPERTY_RDMA_CAPABLE_BIT_NV) {
 *         heapIndex = memoryProperties2.memoryProperties.memoryTypes[memoryType].heapIndex;
 *         break;
 *     }
 * }
 * if ((heapIndex == (uint32_t)-1) ||
 *     (memoryBudgetProperties.heapBudget[heapIndex] < size)) {
 *     return;
 * }
 * 
 * VkPhysicalDeviceExternalBufferInfo externalBufferInfo = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO };
 * externalBufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
 * externalBufferInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV;
 * 
 * VkExternalBufferProperties externalBufferProperties = { VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES };
 * vkGetPhysicalDeviceExternalBufferProperties(physicalDevice, &externalBufferInfo, &externalBufferProperties);
 * 
 * if (!(externalBufferProperties.externalMemoryProperties.externalMemoryFeatures & VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT)) {
 *     return;
 * }
 * 
 * VkExternalMemoryBufferCreateInfo externalMemoryBufferCreateInfo = { VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO };
 * externalMemoryBufferCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV;
 * 
 * VkBufferCreateInfo bufferCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, &externalMemoryBufferCreateInfo };
 * bufferCreateInfo.size = size;
 * bufferCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
 * 
 * VkMemoryRequirements mem_reqs;
 * vkCreateBuffer(device, &bufferCreateInfo, NULL, &buffer);
 * vkGetBufferMemoryRequirements(device, buffer, &mem_reqs);
 * 
 * VkExportMemoryAllocateInfo exportMemoryAllocateInfo = { VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO };
 * exportMemoryAllocateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV;
 * 
 * // Find memory type index
 * uint32_t i = 0;
 * for (; i < VK_MAX_MEMORY_TYPES; i++) {
 *     if ((mem_reqs.memoryTypeBits & (1 << i)) &&
 *         (memoryProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_RDMA_CAPABLE_BIT_NV)) {
 *         break;
 *     }
 * }
 * 
 * VkMemoryAllocateInfo memAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, &exportMemoryAllocateInfo };
 * memAllocInfo.allocationSize = mem_reqs.size;
 * memAllocInfo.memoryTypeIndex = i;
 * 
 * vkAllocateMemory(device, &memAllocInfo, NULL, &mem);
 * vkBindBufferMemory(device, buffer, mem, 0);
 * 
 * VkMemoryGetRemoteAddressInfoNV getMemoryRemoteAddressInfo = { VK_STRUCTURE_TYPE_MEMORY_GET_REMOTE_ADDRESS_INFO_NV };
 * getMemoryRemoteAddressInfo.memory = mem;
 * getMemoryRemoteAddressInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV;
 * 
 * VkRemoteAddressNV rdmaAddress;
 * vkGetMemoryRemoteAddressNV(device, &getMemoryRemoteAddressInfo, &rdmaAddress);
 * // address returned in 'rdmaAddress' can be used by external devices to initiate RDMA transfers
* *
VK_NV_external_memory_rdma
* *
*
Name String
*
{@code VK_NV_external_memory_rdma}
*
Extension Type
*
Device extension
*
Registered Extension Number
*
372
*
Revision
*
1
*
Extension and Version Dependencies
*
    *
  • Requires Vulkan 1.0
  • *
  • Requires {@link KHRExternalMemory VK_KHR_external_memory}
  • *
*
Contact
*
*
* *
Other Extension Metadata
* *
*
Last Modified Date
*
2021-04-19
*
IP Status
*
No known IP claims.
*
Contributors
*
    *
  • Carsten Rohde, NVIDIA
  • *
*
*/ public class NVExternalMemoryRdma { /** The extension specification version. */ public static final int VK_NV_EXTERNAL_MEMORY_RDMA_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_NV_EXTERNAL_MEMORY_RDMA_EXTENSION_NAME = "VK_NV_external_memory_rdma"; /** * Extends {@code VkStructureType}. * *
Enum values:
* *
    *
  • {@link #VK_STRUCTURE_TYPE_MEMORY_GET_REMOTE_ADDRESS_INFO_NV STRUCTURE_TYPE_MEMORY_GET_REMOTE_ADDRESS_INFO_NV}
  • *
  • {@link #VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_RDMA_FEATURES_NV STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_RDMA_FEATURES_NV}
  • *
*/ public static final int VK_STRUCTURE_TYPE_MEMORY_GET_REMOTE_ADDRESS_INFO_NV = 1000371000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_RDMA_FEATURES_NV = 1000371001; /** Extends {@code VkMemoryPropertyFlagBits}. */ public static final int VK_MEMORY_PROPERTY_RDMA_CAPABLE_BIT_NV = 0x100; /** Extends {@code VkExternalMemoryHandleTypeFlagBits}. */ public static final int VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV = 0x1000; protected NVExternalMemoryRdma() { throw new UnsupportedOperationException(); } // --- [ vkGetMemoryRemoteAddressNV ] --- /** Unsafe version of: {@link #vkGetMemoryRemoteAddressNV GetMemoryRemoteAddressNV} */ public static int nvkGetMemoryRemoteAddressNV(VkDevice device, long pMemoryGetRemoteAddressInfo, long pAddress) { long __functionAddress = device.getCapabilities().vkGetMemoryRemoteAddressNV; if (CHECKS) { check(__functionAddress); } return callPPPI(device.address(), pMemoryGetRemoteAddressInfo, pAddress, __functionAddress); } /** * Get an address for a memory object accessible by remote devices. * *
C Specification
* *

To export an address representing the payload of a Vulkan device memory object accessible by remote devices, call:

* *

     * VkResult vkGetMemoryRemoteAddressNV(
     *     VkDevice                                    device,
     *     const VkMemoryGetRemoteAddressInfoNV*       pMemoryGetRemoteAddressInfo,
     *     VkRemoteAddressNV*                          pAddress);
* *
Description
* *

More communication may be required between the kernel-mode drivers of the devices involved. This information is out of scope of this documentation and should be requested from the vendors of the devices.

* *
Valid Usage (Implicit)
* *
    *
  • {@code device} must be a valid {@code VkDevice} handle
  • *
  • {@code pMemoryGetRemoteAddressInfo} must be a valid pointer to a valid {@link VkMemoryGetRemoteAddressInfoNV} structure
  • *
  • {@code pAddress} must be a valid pointer to a {@code VkRemoteAddressNV} value
  • *
* *
Return Codes
* *
*
On success, this command returns
*
    *
  • {@link VK10#VK_SUCCESS SUCCESS}
  • *
*
On failure, this command returns
*
    *
  • {@link VK11#VK_ERROR_INVALID_EXTERNAL_HANDLE ERROR_INVALID_EXTERNAL_HANDLE}
  • *
*
* *
See Also
* *

{@link VkMemoryGetRemoteAddressInfoNV}

* * @param device the logical device that created the device memory being exported. * @param pMemoryGetRemoteAddressInfo a pointer to a {@link VkMemoryGetRemoteAddressInfoNV} structure containing parameters of the export operation. * @param pAddress will return the address representing the payload of the device memory object. */ @NativeType("VkResult") public static int vkGetMemoryRemoteAddressNV(VkDevice device, @NativeType("VkMemoryGetRemoteAddressInfoNV const *") VkMemoryGetRemoteAddressInfoNV pMemoryGetRemoteAddressInfo, @NativeType("VkRemoteAddressNV *") PointerBuffer pAddress) { if (CHECKS) { check(pAddress, 1); } return nvkGetMemoryRemoteAddressNV(device, pMemoryGetRemoteAddressInfo.address(), memAddress(pAddress)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy