SWDEV-403382 - fix errors for vulkan test (#341)
Change-Id: Icfe4c0cf1745c18caeae419e66544b6770f33e70
[ROCm/hip-tests commit: c67e5dae23]
Esse commit está contido em:
commit de
GitHub
pai
799859507d
commit
ce58c13ffa
@@ -24,6 +24,8 @@ THE SOFTWARE.
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
||||
VkFence VulkanTest::CreateFence() {
|
||||
VkFence fence;
|
||||
VkFenceCreateInfo fence_create_info = {};
|
||||
@@ -80,7 +82,7 @@ hipExternalMemoryHandleDesc VulkanTest::BuildMemoryDescriptor(VkDeviceMemory vk_
|
||||
hipExternalMemoryHandleDesc mem_handle_desc = {};
|
||||
mem_handle_desc.type = VulkanMemHandleTypeToHIPHandleType();
|
||||
#ifdef _WIN64
|
||||
mem_handle_desc.handle.win32.handle = GetMemoryHandle(ck_mem);
|
||||
mem_handle_desc.handle.win32.handle = GetMemoryHandle(vk_mem);
|
||||
#else
|
||||
mem_handle_desc.handle.fd = GetMemoryHandle(vk_mem);
|
||||
#endif
|
||||
@@ -170,7 +172,7 @@ bool VulkanTest::CheckExtensionSupport(std::vector<const char*> expected_extensi
|
||||
std::back_inserter(supported_extensions),
|
||||
[](const auto& p) { return p.extensionName; });
|
||||
|
||||
constexpr auto p = [](const char* l, const char* r) { return strcmp(l, r) < 0; };
|
||||
auto p = [](const char* l, const char* r) { return strcmp(l, r) < 0; };
|
||||
std::sort(expected_extensions.begin(), expected_extensions.end(), p);
|
||||
std::sort(supported_extensions.begin(), supported_extensions.end(), p);
|
||||
|
||||
@@ -328,7 +330,7 @@ int VulkanTest::GetSemaphoreHandle(VkSemaphore semaphore) {
|
||||
#ifdef _WIN64
|
||||
HANDLE
|
||||
VulkanTest::GetMemoryHandle(VkDeviceMemory memory) {
|
||||
Handle handle = 0;
|
||||
HANDLE handle = 0;
|
||||
|
||||
VkMemoryGetWin32HandleInfoKHR vkMemoryGetWin32HandleInfoKHR = {};
|
||||
vkMemoryGetWin32HandleInfoKHR.sType = VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR;
|
||||
@@ -336,7 +338,7 @@ VulkanTest::GetMemoryHandle(VkDeviceMemory memory) {
|
||||
vkMemoryGetWin32HandleInfoKHR.handleType = _mem_handle_type;
|
||||
|
||||
PFN_vkGetMemoryWin32HandleKHR fpGetMemoryWin32HandleKHR =
|
||||
(PFN_vkGetMemoryWin32HandleKHR)vkGetDeviceProcAddr(m_device, "vkGetMemoryWin32HandleKHR");
|
||||
(PFN_vkGetMemoryWin32HandleKHR)vkGetDeviceProcAddr(_device, "vkGetMemoryWin32HandleKHR");
|
||||
|
||||
if (!fpGetMemoryWin32HandleKHR) {
|
||||
throw std::runtime_error("Failed to retrieve vkGetMemoryWin32HandleKHR");
|
||||
@@ -407,4 +409,5 @@ hipExternalSemaphore_t ImportBinarySemaphore(VulkanTest& vkt) {
|
||||
HIP_CHECK(hipImportExternalSemaphore(&hip_ext_semaphore, &sem_handle_desc));
|
||||
|
||||
return hip_ext_semaphore;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,24 @@ THE SOFTWARE.
|
||||
#pragma once
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
#include <Windows.h>
|
||||
#include <winnt.h>
|
||||
#include <VersionHelpers.h>
|
||||
|
||||
#include <winapifamily.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <windef.h>
|
||||
#include <aclapi.h>
|
||||
#include <securitybaseapi.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan_win32.h>
|
||||
#include <vector>
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip/hip_runtime_api.h>
|
||||
|
||||
@@ -39,6 +51,72 @@ THE SOFTWARE.
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
class WindowsSecurityAttributes
|
||||
{
|
||||
protected:
|
||||
SECURITY_ATTRIBUTES m_winSecurityAttributes;
|
||||
PSECURITY_DESCRIPTOR m_winPSecurityDescriptor;
|
||||
|
||||
public:
|
||||
WindowsSecurityAttributes::WindowsSecurityAttributes()
|
||||
{
|
||||
m_winPSecurityDescriptor = (PSECURITY_DESCRIPTOR)calloc(1, SECURITY_DESCRIPTOR_MIN_LENGTH + 2 * sizeof(void **));
|
||||
if (!m_winPSecurityDescriptor) {
|
||||
throw std::runtime_error("Failed to allocate memory for security descriptor");
|
||||
}
|
||||
|
||||
PSID *ppSID = (PSID *)((PBYTE)m_winPSecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||
PACL *ppACL = (PACL *)((PBYTE)ppSID + sizeof(PSID *));
|
||||
|
||||
InitializeSecurityDescriptor(m_winPSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
|
||||
|
||||
SID_IDENTIFIER_AUTHORITY sidIdentifierAuthority = SECURITY_WORLD_SID_AUTHORITY;
|
||||
AllocateAndInitializeSid(&sidIdentifierAuthority, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, ppSID);
|
||||
|
||||
EXPLICIT_ACCESS explicitAccess;
|
||||
ZeroMemory(&explicitAccess, sizeof(EXPLICIT_ACCESS));
|
||||
explicitAccess.grfAccessPermissions = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL;
|
||||
explicitAccess.grfAccessMode = SET_ACCESS;
|
||||
explicitAccess.grfInheritance = INHERIT_ONLY;
|
||||
explicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
||||
explicitAccess.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
|
||||
explicitAccess.Trustee.ptstrName = (LPTSTR) * ppSID;
|
||||
|
||||
SetEntriesInAcl(1, &explicitAccess, NULL, ppACL);
|
||||
|
||||
SetSecurityDescriptorDacl(m_winPSecurityDescriptor, TRUE, *ppACL, FALSE);
|
||||
|
||||
m_winSecurityAttributes.nLength = sizeof(m_winSecurityAttributes);
|
||||
m_winSecurityAttributes.lpSecurityDescriptor = m_winPSecurityDescriptor;
|
||||
m_winSecurityAttributes.bInheritHandle = TRUE;
|
||||
}
|
||||
|
||||
SECURITY_ATTRIBUTES *
|
||||
WindowsSecurityAttributes::operator&()
|
||||
{
|
||||
return &m_winSecurityAttributes;
|
||||
}
|
||||
|
||||
WindowsSecurityAttributes::~WindowsSecurityAttributes()
|
||||
{
|
||||
PSID *ppSID = (PSID *)((PBYTE)m_winPSecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||
PACL *ppACL = (PACL *)((PBYTE)ppSID + sizeof(PSID *));
|
||||
|
||||
if (*ppSID) {
|
||||
FreeSid(*ppSID);
|
||||
}
|
||||
if (*ppACL) {
|
||||
LocalFree(*ppACL);
|
||||
}
|
||||
free(m_winPSecurityDescriptor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* _WIN64 */
|
||||
|
||||
|
||||
class VulkanTest {
|
||||
public:
|
||||
VulkanTest(bool enable_validation)
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário