radv: Add trivial device group implementation.

Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Bas Nieuwenhuizen
2018-01-21 17:13:26 +01:00
parent 84e877aa77
commit 5240fddb9d
5 changed files with 79 additions and 0 deletions

View File

@@ -3810,3 +3810,10 @@ void radv_CmdWaitEvents(VkCommandBuffer commandBuffer,
RADV_CMD_FLAG_INV_VMEM_L1 | RADV_CMD_FLAG_INV_VMEM_L1 |
RADV_CMD_FLAG_INV_SMEM_L1; RADV_CMD_FLAG_INV_SMEM_L1;
} }
void radv_CmdSetDeviceMask(VkCommandBuffer commandBuffer,
uint32_t deviceMask)
{
/* No-op */
}

View File

@@ -592,6 +592,35 @@ VkResult radv_EnumeratePhysicalDevices(
: VK_SUCCESS; : VK_SUCCESS;
} }
VkResult radv_EnumeratePhysicalDeviceGroups(
VkInstance _instance,
uint32_t* pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
{
RADV_FROM_HANDLE(radv_instance, instance, _instance);
VkResult result;
if (instance->physicalDeviceCount < 0) {
result = radv_enumerate_devices(instance);
if (result != VK_SUCCESS &&
result != VK_ERROR_INCOMPATIBLE_DRIVER)
return result;
}
if (!pPhysicalDeviceGroupProperties) {
*pPhysicalDeviceGroupCount = instance->physicalDeviceCount;
} else {
*pPhysicalDeviceGroupCount = MIN2(*pPhysicalDeviceGroupCount, instance->physicalDeviceCount);
for (unsigned i = 0; i < *pPhysicalDeviceGroupCount; ++i) {
pPhysicalDeviceGroupProperties[i].physicalDeviceCount = 1;
pPhysicalDeviceGroupProperties[i].physicalDevices[0] = radv_physical_device_to_handle(instance->physicalDevices + i);
pPhysicalDeviceGroupProperties[i].subsetAllocation = false;
}
}
return *pPhysicalDeviceGroupCount < instance->physicalDeviceCount ? VK_INCOMPLETE
: VK_SUCCESS;
}
void radv_GetPhysicalDeviceFeatures( void radv_GetPhysicalDeviceFeatures(
VkPhysicalDevice physicalDevice, VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures* pFeatures) VkPhysicalDeviceFeatures* pFeatures)
@@ -4270,3 +4299,19 @@ radv_DebugReportMessageEXT(VkInstance _instance,
vk_debug_report(&instance->debug_report_callbacks, flags, objectType, vk_debug_report(&instance->debug_report_callbacks, flags, objectType,
object, location, messageCode, pLayerPrefix, pMessage); object, location, messageCode, pLayerPrefix, pMessage);
} }
void
radv_GetDeviceGroupPeerMemoryFeatures(
VkDevice device,
uint32_t heapIndex,
uint32_t localDeviceIndex,
uint32_t remoteDeviceIndex,
VkPeerMemoryFeatureFlags* pPeerMemoryFeatures)
{
assert(localDeviceIndex == remoteDeviceIndex);
*pPeerMemoryFeatures = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT |
VK_PEER_MEMORY_FEATURE_COPY_DST_BIT |
VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT |
VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
}

View File

@@ -54,6 +54,8 @@ EXTENSIONS = [
Extension('VK_KHR_bind_memory2', 1, True), Extension('VK_KHR_bind_memory2', 1, True),
Extension('VK_KHR_dedicated_allocation', 1, True), Extension('VK_KHR_dedicated_allocation', 1, True),
Extension('VK_KHR_descriptor_update_template', 1, True), Extension('VK_KHR_descriptor_update_template', 1, True),
Extension('VK_KHR_device_group', 1, True),
Extension('VK_KHR_device_group_creation', 1, True),
Extension('VK_KHR_external_fence', 1, 'device->rad_info.has_syncobj_wait_for_submit'), Extension('VK_KHR_external_fence', 1, 'device->rad_info.has_syncobj_wait_for_submit'),
Extension('VK_KHR_external_fence_capabilities', 1, True), Extension('VK_KHR_external_fence_capabilities', 1, True),
Extension('VK_KHR_external_fence_fd', 1, 'device->rad_info.has_syncobj_wait_for_submit'), Extension('VK_KHR_external_fence_fd', 1, 'device->rad_info.has_syncobj_wait_for_submit'),

View File

@@ -53,6 +53,7 @@ static const struct nir_shader_compiler_options nir_options = {
.lower_scmp = true, .lower_scmp = true,
.lower_flrp32 = true, .lower_flrp32 = true,
.lower_flrp64 = true, .lower_flrp64 = true,
.lower_device_index_to_zero = true,
.lower_fsat = true, .lower_fsat = true,
.lower_fdiv = true, .lower_fdiv = true,
.lower_sub = true, .lower_sub = true,
@@ -203,6 +204,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
} }
const struct spirv_to_nir_options spirv_options = { const struct spirv_to_nir_options spirv_options = {
.caps = { .caps = {
.device_group = true,
.draw_parameters = true, .draw_parameters = true,
.float64 = true, .float64 = true,
.image_read_without_format = true, .image_read_without_format = true,

View File

@@ -234,3 +234,26 @@ VkResult radv_QueuePresentKHR(
queue->queue_family_index, queue->queue_family_index,
pPresentInfo); pPresentInfo);
} }
VkResult radv_GetDeviceGroupPresentCapabilitiesKHR(
VkDevice device,
VkDeviceGroupPresentCapabilitiesKHR* pCapabilities)
{
memset(pCapabilities->presentMask, 0,
sizeof(pCapabilities->presentMask));
pCapabilities->presentMask[0] = 0x1;
pCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
return VK_SUCCESS;
}
VkResult radv_GetDeviceGroupSurfacePresentModesKHR(
VkDevice device,
VkSurfaceKHR surface,
VkDeviceGroupPresentModeFlagsKHR* pModes)
{
*pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
return VK_SUCCESS;
}