Skip to content

Commit

Permalink
Update XGL from commit: 2072cab
Browse files Browse the repository at this point in the history
1. Implement VK_AMD_buffer_marker extension
2. Implement VK_EXT_debug_report extension
3. Pass layout to InitImmutableDescriptors(). This removes 80% of the
time in DescriptorSet::Reassign()
4. Calculate location of bindings for descriptor set layout to avoid a
memory lookup
5. Disable depth clamping when enableDepthClamp is set to false
6. Fix CTS dEQP-VK.tessellation.shader_input_output.barrier failure,
simplify the TessFactorToBuffer offset calculation
7. Fix CTS dEQP-VK.glsl.440.linkage.varying.component group testing
failure
  • Loading branch information
JacobHeAMD committed Jan 22, 2018
1 parent 02f11b6 commit 3e2d125
Show file tree
Hide file tree
Showing 57 changed files with 2,392 additions and 648 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ option(USE_NEXT_SDK "Use next SDK?" OFF)

option(ICD_BUILD_VIDEO "Build Video Support?" OFF)

option(ICD_UPSTREAM_LLVM "Build with upstream LLVM?" OFF)

if(NOT ICD_BUILD_LLPC)
set(ICD_UPSTREAM_LLVM OFF CACHE BOOL "ICD_UPSTREAM_LLVM is overrided to false." FORCE)
endif()

option(ICD_GPUOPEN_DEVMODE_BUILD "Build ${PROJECT_NAME} with GPU Open Developer Mode driver support?" ON)

option(ICD_MEMTRACK "Turn on memory tracking?" ${CMAKE_BUILD_TYPE_DEBUG})
Expand Down
1 change: 1 addition & 0 deletions icd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ target_sources(xgl PRIVATE
api/vk_cmd_pool.cpp
api/vk_compute_pipeline.cpp
api/vk_conv.cpp
api/vk_debug_report.cpp
api/vk_descriptor_set.cpp
api/vk_descriptor_set_layout.cpp
api/vk_descriptor_pool.cpp
Expand Down
9 changes: 8 additions & 1 deletion icd/api/include/internal_mem_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ class InternalMemory
return m_gpuVA[idx];
}

void* CpuAddr(int32_t idx = DefaultDeviceIndex) const
{
VK_ASSERT((idx >= 0) && (idx < static_cast<int32_t>(MaxPalDevices)));
return m_memoryPool.groupMemory.CpuAddr(idx);
}

Pal::gpusize Offset() const
{ return m_offset; }

Expand Down Expand Up @@ -210,7 +216,8 @@ class InternalMemMgr
Pal::IGpuMemoryBindable* pBindable,
bool readOnly,
InternalMemory* pInternalMemory,
bool removeInvisibleHeap = false);
bool removeInvisibleHeap = false,
bool persistentMapped = false);

void FreeGpuMem(
const InternalMemory* pInternalMemory);
Expand Down
54 changes: 54 additions & 0 deletions icd/api/include/khronos/devext/vk_amd_buffer_marker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
***********************************************************************************************************************
*
* Copyright (c) 2014-2018 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
**********************************************************************************************************************/
/**
**********************************************************************************************************************
* @file vk_amd_buffer_marker.h
* @brief Header for VK_AMD_buffer marker extension.
**********************************************************************************************************************
*/
#ifndef VK_AMD_BUFFER_MARKER_H_
#define VK_AMD_BUFFER_MARKER_H_

#define VK_AMD_buffer_marker 1
#define VK_AMD_BUFFER_MARKER_SPEC_VERSION 1
#define VK_AMD_BUFFER_MARKER_EXTENSION_NUMBER 180

#define VK_AMD_BUFFER_MARKER_EXTENSION_NAME "VK_AMD_buffer_marker"

typedef void (VKAPI_PTR *PFN_vkCmdWriteBufferMarkerAMD)(
VkCommandBuffer commandBuffer,
VkPipelineStageFlagBits pipelineStage,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
uint32_t marker);

VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarkerAMD(
VkCommandBuffer commandBuffer,
VkPipelineStageFlagBits pipelineStage,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
uint32_t marker);

#endif /* VK_AMD_BUFFER_MARKER_H_ */
1 change: 1 addition & 0 deletions icd/api/include/khronos/vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
// Internal (under development) extension definitions

#include "devext/vk_amd_gpa_interface.h"
#include "devext/vk_amd_buffer_marker.h"

enum class DynamicStatesInternal : uint32_t {
VIEWPORT = 0,
Expand Down
1 change: 1 addition & 0 deletions icd/api/include/vk_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class Buffer : public NonDispatchable<VkBuffer, Buffer>
BufferFlags internalFlags);

void CalcBarrierUsage(
const Device* pDevice,
VkBufferUsageFlags usage);

Pal::IGpuMemory* m_pGpuMemory[MaxPalDevices];
Expand Down
19 changes: 17 additions & 2 deletions icd/api/include/vk_cmdbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,12 @@ class CmdBuffer
uint32_t length,
const void* values);

void WriteBufferMarker(
VkPipelineStageFlagBits pipelineStage,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
uint32_t marker);

VK_INLINE void SetDeviceMask(uint32_t deviceMask)
{
// Ensure we are enabling valid devices within the group
Expand Down Expand Up @@ -541,9 +547,10 @@ class CmdBuffer
return m_pPalCmdBuffers[idx];
}

static Pal::uint32 ConvertBarrierSrcAccessFlags(VkAccessFlags accessMask);
static Pal::uint32 ConvertBarrierDstAccessFlags(VkAccessFlags accessMask);
static Pal::uint32 ConvertBarrierSrcAccessFlags(const Device* pDevice, VkAccessFlags accessMask);
static Pal::uint32 ConvertBarrierDstAccessFlags(const Device* pDevice, VkAccessFlags accessMask);
static void ConvertBarrierCacheFlags(
const Device* pDevice,
VkAccessFlags srcAccess,
VkAccessFlags dstAccess,
uint32_t supportInputCacheMask,
Expand Down Expand Up @@ -1337,6 +1344,14 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT(
VKAPI_ATTR void VKAPI_CALL vkCmdSetSampleLocationsEXT(
VkCommandBuffer commandBuffer,
const VkSampleLocationsInfoEXT* pSampleLocationsInfo);

VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarkerAMD(
VkCommandBuffer commandBuffer,
VkPipelineStageFlagBits pipelineStage,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
uint32_t marker);

} // namespace entry

} // namespace vk
Expand Down
31 changes: 31 additions & 0 deletions icd/api/include/vk_conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,37 @@ VK_INLINE Pal::HwPipePoint VkToPalSrcPipePointForTimestampWrite(VkPipelineStageF
return srcPipePoint;
}

// =====================================================================================================================
// Converts Vulkan source pipeline stage flags to PAL buffer marker writes (top/bottom only)
VK_INLINE Pal::HwPipePoint VkToPalSrcPipePointForMarkers(
VkPipelineStageFlags flags,
Pal::EngineType engineType)
{
// This function is written against the following three engine types. If you hit this assert then check if this
// new engine supports top of pipe writes at all (e.g. SDMA doesn't).
VK_ASSERT(engineType == Pal::EngineTypeDma ||
engineType == Pal::EngineTypeUniversal ||
engineType == Pal::EngineTypeCompute);

// Flags that allow signaling at top-of-pipe (anything else maps to bottom)
constexpr VkPipelineStageFlags SrcTopOfPipeFlags =
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;

Pal::HwPipePoint srcPipePoint;

if (((flags & ~SrcTopOfPipeFlags) == 0) &&
(engineType != Pal::EngineTypeDma)) // SDMA engines only support bottom of pipe writes
{
srcPipePoint = Pal::HwPipeTop;
}
else
{
srcPipePoint = Pal::HwPipeBottom;
}

return srcPipePoint;
}

// Helper structure for mapping stage flag sets to PAL pipe points
struct HwPipePointMappingEntry
{
Expand Down
102 changes: 102 additions & 0 deletions icd/api/include/vk_debug_report.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
***********************************************************************************************************************
*
* Copyright (c) 2018 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
**********************************************************************************************************************/

#ifndef __VK_DEBUG_REPORT_H__
#define __VK_DEBUG_REPORT_H__

#pragma once

#include "include/vk_dispatch.h"

namespace vk
{

// =====================================================================================================================
// Vulkan implementation of VK_EXT_debug_report extension
class DebugReportCallback : public NonDispatchable<VkDebugReportCallbackEXT, DebugReportCallback>
{
public:
static VkResult Create(
Instance* pInstance,
const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDebugReportCallbackEXT* pCallback);

void Destroy(
Instance* pInstance,
const VkAllocationCallbacks* pAllocator);

void Message(
Instance* pInstance,
VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType,
uint64_t object,
size_t location,
int32_t messageCode,
const char* pLayerPrefix,
const char* pMessage);

VkDebugReportFlagsEXT GetFlags();

PFN_vkDebugReportCallbackEXT GetCallbackFunc();

void* GetUserData();

protected:
DebugReportCallback()
{
};

private:
VkDebugReportCallbackCreateInfoEXT m_createInfo;
};

namespace entry
{
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(
VkInstance instance,
const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDebugReportCallbackEXT* pCallback);

VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(
VkInstance instance,
VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks* pAllocator);

VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
VkInstance instance,
VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType,
uint64_t object,
size_t location,
int32_t messageCode,
const char* pLayerPrefix,
const char* pMessage);
} // namespace entry

} // namespace vk

#endif /* __VK_DEBUG_REPORT_H__ */
4 changes: 3 additions & 1 deletion icd/api/include/vk_descriptor_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ class DescriptorSet : public NonDispatchable<VkDescriptorSet, DescriptorSet>
void* pAllocHandle,
VkDescriptorSet* pHandle);

void InitImmutableDescriptors(uint32_t numPalDevices);
void InitImmutableDescriptors(
const DescriptorSetLayout* pLayout,
uint32_t numPalDevices);

void* AllocHandle() const
{ return m_pAllocHandle; }
Expand Down
11 changes: 8 additions & 3 deletions icd/api/include/vk_descriptor_set_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class DescriptorSetLayout : public NonDispatchable<VkDescriptorSetLayout, Descri
struct CreateInfo
{
uint32_t count; // Total number of layout entries
BindingInfo* bindings; // Array of entries
uint32_t activeStageMask; // Shader stage mask describing which stages in which at least one
// binding of this layout's set is active
uint32_t numDynamicDescriptors; // Number of dynamic descriptors in this layout
Expand All @@ -110,7 +109,12 @@ class DescriptorSetLayout : public NonDispatchable<VkDescriptorSetLayout, Descri
Device* pDevice,
const VkAllocationCallbacks* pAllocator);

const BindingInfo& Binding(uint32_t bindingIndex) const { return m_info.bindings[bindingIndex]; }
const BindingInfo& Binding(uint32_t bindingIndex) const
{
// The bindings are allocated immediately after the object. See DescriptorSetLayout::Create().
BindingInfo* pBindings = static_cast<BindingInfo*>(Util::VoidPtrInc(this, sizeof(*this)));
return pBindings[bindingIndex];
}

const CreateInfo& Info() const { return m_info; }

Expand All @@ -133,7 +137,8 @@ class DescriptorSetLayout : public NonDispatchable<VkDescriptorSetLayout, Descri
static VkResult ConvertCreateInfo(
const Device* pDevice,
const VkDescriptorSetLayoutCreateInfo* pIn,
CreateInfo* pInfo);
CreateInfo* pInfo,
BindingInfo* pOutBindings);

static void ConvertBindingInfo(
const VkDescriptorSetLayoutBinding* pBindingInfo,
Expand Down
3 changes: 3 additions & 0 deletions icd/api/include/vk_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class InstanceExtensions : public Extensions<InstanceExtensions>
KHX_DEVICE_GROUP_CREATION,
KHR_EXTERNAL_SEMAPHORE_CAPABILITIES,
KHR_EXTERNAL_FENCE_CAPABILITIES,
EXT_DEBUG_REPORT,
Count
};
};
Expand Down Expand Up @@ -237,6 +238,8 @@ class DeviceExtensions : public Extensions<DeviceExtensions>
KHR_EXTERNAL_FENCE_WIN32,
KHR_WIN32_KEYED_MUTEX,
EXT_GLOBAL_PRIORITY,
AMD_BUFFER_MARKER,

Count
};
};
Expand Down
Loading

0 comments on commit 3e2d125

Please sign in to comment.