Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/gpgmm/common/GPUInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#ifndef SRC_GPGMM_COMMON_GPUINFO_H_
#define SRC_GPGMM_COMMON_GPUINFO_H_

#include <cstdint>

namespace gpgmm {

enum class GPUVendor {
Expand All @@ -24,6 +26,11 @@ namespace gpgmm {
kIntel_Vendor = 32902,
kNvidia_Vendor = 4318,
kQualcomm_Vendor = 20803,
kMicrosoft_Vendor = 0x1414,
};

enum class GPUDevice {
kWARP_Device = 0x8c,
};

} // namespace gpgmm
Expand Down
27 changes: 18 additions & 9 deletions src/tests/D3D12Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <gpgmm_d3d12.h>

#include "gpgmm/common/GPUInfo.h"
#include "gpgmm/common/SizeClass.h"
#include "gpgmm/d3d12/CapsD3D12.h"
#include "gpgmm/d3d12/ResidencyManagerD3D12.h"
Expand Down Expand Up @@ -83,19 +84,18 @@ namespace gpgmm::d3d12 {
ASSERT_SUCCEEDED(dxgiFactory4->EnumAdapterByLuid(adapterLUID, IID_PPV_ARGS(&mAdapter)));
ASSERT_NE(mAdapter.Get(), nullptr);

DXGI_ADAPTER_DESC adapterDesc;
ASSERT_SUCCEEDED(mAdapter->GetDesc(&adapterDesc));
ASSERT_SUCCEEDED(mAdapter->GetDesc(&mAdapterDesc));

DebugLog() << "GPU: " << WCharToUTF8(adapterDesc.Description)
<< " (device: " << ToHexStr(adapterDesc.DeviceId)
<< ", vendor: " << ToHexStr(adapterDesc.VendorId) << ")";
DebugLog() << "GPU: " << WCharToUTF8(mAdapterDesc.Description)
<< " (device: " << ToHexStr(mAdapterDesc.DeviceId)
<< ", vendor: " << ToHexStr(mAdapterDesc.VendorId) << ")";
DebugLog() << "System memory: "
<< GPGMM_BYTES_TO_GB(adapterDesc.SharedSystemMemory +
adapterDesc.DedicatedSystemMemory)
<< GPGMM_BYTES_TO_GB(mAdapterDesc.SharedSystemMemory +
mAdapterDesc.DedicatedSystemMemory)
<< " GBs"
<< " (" << GPGMM_BYTES_TO_GB(adapterDesc.DedicatedSystemMemory)
<< " (" << GPGMM_BYTES_TO_GB(mAdapterDesc.DedicatedSystemMemory)
<< " dedicated) ";
DebugLog() << "GPU memory: " << GPGMM_BYTES_TO_GB(adapterDesc.DedicatedVideoMemory)
DebugLog() << "GPU memory: " << GPGMM_BYTES_TO_GB(mAdapterDesc.DedicatedVideoMemory)
<< " GBs.";

Caps* capsPtr = nullptr;
Expand Down Expand Up @@ -124,6 +124,10 @@ namespace gpgmm::d3d12 {

void D3D12TestBase::TearDown() {
GPGMMTestBase::TearDown();

// Check that nothing was leaked from the D3D12 device.
// If the test doesn't fully clean-up itself, this will trip.
EXPECT_REFCOUNT_EQ(mDevice.Get(), 1);
}

RESOURCE_ALLOCATOR_DESC D3D12TestBase::CreateBasicAllocatorDesc() const {
Expand Down Expand Up @@ -210,4 +214,9 @@ namespace gpgmm::d3d12 {
#endif
}

bool D3D12TestBase::IsAdapterMicrosoftWARP() const {
return mAdapterDesc.VendorId == static_cast<UINT>(GPUVendor::kMicrosoft_Vendor) &&
mAdapterDesc.DeviceId == static_cast<UINT>(GPUDevice::kWARP_Device);
}

} // namespace gpgmm::d3d12
3 changes: 3 additions & 0 deletions src/tests/D3D12Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ namespace gpgmm::d3d12 {

D3D12_MESSAGE_SEVERITY GetDefaultLogLevel() const;

bool IsAdapterMicrosoftWARP() const;

protected:
ComPtr<IDXGIAdapter3> mAdapter;
ComPtr<ID3D12Device> mDevice;
std::unique_ptr<Caps> mCaps;
std::string mTraceFile;
DXGI_ADAPTER_DESC mAdapterDesc = {};
};

} // namespace gpgmm::d3d12
Expand Down
3 changes: 3 additions & 0 deletions src/tests/end2end/D3D12ResidencyManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,9 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetWithMappedResources) {
// swaps the residency status using ExecuteCommandList: first set gets paged-in again, second set
// gets paged-out.
TEST_F(D3D12ResidencyManagerTests, OverBudgetExecuteCommandList) {
// Disable for WARP because the device always leaks after this test ends.
GPGMM_SKIP_TEST_IF(IsAdapterMicrosoftWARP());

ComPtr<IResidencyManager> residencyManager;
ASSERT_SUCCEEDED(CreateResidencyManager(CreateBasicResidencyDesc(kDefaultBudget), mDevice.Get(),
mAdapter.Get(), &residencyManager));
Expand Down