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
6 changes: 6 additions & 0 deletions .github/workflows/win_clang_dbg_x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ jobs:
cd test
out\Debug\gpgmm_capture_replay_tests.exe --log-level=DEBUG --gtest_output=json:${{ github.workspace }}\..\test_capture_replay_tests.json 2>&1

- name: Run gpgmm_capture_replay_tests to re-capture (with patch)
shell: cmd
run: |
cd test
out\Debug\gpgmm_capture_replay_tests.exe -log-level=DEBUG --gtest_filter=*Replay/* --capture-mask=0x3 --ignore-caps-mismatch --disable-memory

- name: Regression check end2end tests
run: |
python test\scripts\regression_check.py ${{ github.workspace }}\..\baseline_end2end_tests.json ${{ github.workspace }}\..\test_end2end_tests.json
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/win_clang_rel_x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ jobs:
cd test
out\Release\gpgmm_capture_replay_tests.exe --gtest_output=json:${{ github.workspace }}\..\test_capture_replay_tests.json

- name: Run gpgmm_capture_replay_tests to re-capture (with patch)
shell: cmd
run: |
cd test
out\Release\gpgmm_capture_replay_tests.exe --gtest_filter=*Replay/* --capture-mask=0x3 --ignore-caps-mismatch --disable-memory

- name: Regression check end2end tests
run: |
python test\scripts\regression_check.py ${{ github.workspace }}\..\baseline_end2end_tests.json ${{ github.workspace }}\..\test_end2end_tests.json
Expand Down
24 changes: 8 additions & 16 deletions src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith
const Json::Value& args = event["args"];
ASSERT_FALSE(args.empty());

if (envParams.IsAllocationPlaybackDisabled) {
if (envParams.IsAllocatorDisabled) {
continue;
}

Expand Down Expand Up @@ -305,7 +305,7 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith
<< "Capture device does not match playback device (IsUMA: " +
std::to_string(snapshot["IsUMA"].asBool()) + " vs " +
std::to_string(mIsUMA) + ").";
GPGMM_SKIP_TEST_IF(envParams.IsSameCapsRequired);
GPGMM_SKIP_TEST_IF(!envParams.IsIgnoreCapsMismatchEnabled);
}

RESIDENCY_DESC residencyDesc = {};
Expand Down Expand Up @@ -430,7 +430,7 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith
std::to_string(snapshot["ResourceHeapTier"].asInt()) +
" vs " + std::to_string(allocatorDesc.ResourceHeapTier) +
").";
GPGMM_SKIP_TEST_IF(envParams.IsSameCapsRequired);
GPGMM_SKIP_TEST_IF(!envParams.IsIgnoreCapsMismatchEnabled);
}

ComPtr<ResidencyManager> residencyManager;
Expand Down Expand Up @@ -479,6 +479,10 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith
continue;
}

if (envParams.IsMemoryDisabled) {
continue;
}

D3D12_HEAP_PROPERTIES heapProperties = {};
heapProperties.Type = static_cast<D3D12_HEAP_TYPE>(
args["Heap"]["Properties"]["Type"].asInt());
Expand Down Expand Up @@ -587,8 +591,6 @@ TEST_P(D3D12EventTraceReplay, Replay) {
// Verify that playback of a captured trace does not exceed peak usage.
TEST_P(D3D12EventTraceReplay, PeakUsage) {
TestEnviromentParams forceParams = {};
forceParams.IsSameCapsRequired = true;

RunSingleTest(forceParams);

EXPECT_LE(mReplayedMemoryStats.PeakUsage, mCapturedMemoryStats.PeakUsage);
Expand All @@ -605,15 +607,14 @@ TEST_P(D3D12EventTraceReplay, AllowPrefetch) {
// Verify no heap re-use through sub-allocation will succeed.
TEST_P(D3D12EventTraceReplay, DisableSuballocation) {
TestEnviromentParams forceParams = {};
forceParams.IsSameCapsRequired = true;
forceParams.IsSuballocationDisabled = true;

RunSingleTest(forceParams);

EXPECT_LE(mReplayedMemoryStats.PeakUsage, mCapturedMemoryStats.PeakUsage);
}

// Verify that playback with memory creation disabled will succeed.
// Verify that playback no memory created will succeed.
TEST_P(D3D12EventTraceReplay, NeverAllocate) {
TestEnviromentParams forceParams = {};
forceParams.IsNeverAllocate = true;
Expand All @@ -623,13 +624,4 @@ TEST_P(D3D12EventTraceReplay, NeverAllocate) {
EXPECT_LE(mReplayedMemoryStats.PeakUsage, 0u);
}

// Playback captured trace into a new trace with capture-only events.
// Test must run last since the new trace will replace the old trace.
TEST_P(D3D12EventTraceReplay, Recapture) {
TestEnviromentParams forceParams = {};

forceParams.CaptureEventMask = EVENT_RECORD_FLAG_CAPTURE;
RunSingleTest(forceParams);
}

GPGMM_INSTANTIATE_CAPTURE_REPLAY_TEST(D3D12EventTraceReplay);
29 changes: 14 additions & 15 deletions src/tests/capture_replay_tests/GPGMMCaptureReplayTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ GPGMMCaptureReplayTestEnvironment::GPGMMCaptureReplayTestEnvironment(int argc, c
continue;
}

if (strcmp("--same-caps", argv[i]) == 0) {
mParams.IsSameCapsRequired = true;
if (strcmp("--ignore-caps-mismatch", argv[i]) == 0) {
mParams.IsIgnoreCapsMismatchEnabled = true;
continue;
}

Expand All @@ -95,8 +95,13 @@ GPGMMCaptureReplayTestEnvironment::GPGMMCaptureReplayTestEnvironment(int argc, c
continue;
}

if (strcmp("--disable-allocation-playback", argv[i]) == 0) {
mParams.IsAllocationPlaybackDisabled = true;
if (strcmp("--disable-allocation", argv[i]) == 0) {
mParams.IsAllocatorDisabled = true;
continue;
}

if (strcmp("--disable-memory", argv[i]) == 0) {
mParams.IsMemoryDisabled = true;
continue;
}

Expand Down Expand Up @@ -135,8 +140,8 @@ GPGMMCaptureReplayTestEnvironment::GPGMMCaptureReplayTestEnvironment(int argc, c
<< " --playback-file: Path to captured file to playback.\n"
<< " --same-caps: Captured device must be compatible with playback device.\n"
<< " --profile=[MAXPERF|LOWMEM|CAPTURED|DEFAULT]: Profile to apply.\n"
<< " --disable-allocation-playback: Disable allocation playback for testing "
"budgets.\n";
<< " --disable-allocator: Disables allocator playback.\n"
<< " --disable-memory: Disables playback of memory from capture.\n";
continue;
}
}
Expand All @@ -159,16 +164,10 @@ void GPGMMCaptureReplayTestEnvironment::TearDown() {
void GPGMMCaptureReplayTestEnvironment::PrintCaptureReplaySettings() const {
gpgmm::InfoLog() << "Playback settings\n"
"-----------------\n"
<< "Iterations per test: " << mParams.Iterations << "\n"
<< "Must use same caps: " << (mParams.IsSameCapsRequired ? "true" : "false")
<< "\n"
<< "No Allocations: "
<< (mParams.IsAllocationPlaybackDisabled ? "true" : "false") << "\n";
<< "Iterations per test: " << mParams.Iterations << "\n";

gpgmm::InfoLog() << "Experiment settings\n"
"-------------------\n"
<< "Disable sub-allocation: "
<< (mParams.IsSuballocationDisabled ? "true" : "false") << "\n"
<< "Profile: " << AllocatorProfileToString(mParams.AllocatorProfile) << "\n";
}

Expand Down Expand Up @@ -221,8 +220,8 @@ void CaptureReplayTestWithParams::RunTestLoop(const TestEnviromentParams& forceP
envParams.CaptureEventMask |= forceParams.CaptureEventMask;
}

if (forceParams.IsSameCapsRequired != envParams.IsSameCapsRequired) {
envParams.IsSameCapsRequired |= forceParams.IsSameCapsRequired;
if (forceParams.IsIgnoreCapsMismatchEnabled != envParams.IsIgnoreCapsMismatchEnabled) {
envParams.IsIgnoreCapsMismatchEnabled |= forceParams.IsIgnoreCapsMismatchEnabled;
}

if (forceParams.Iterations != envParams.Iterations) {
Expand Down
5 changes: 3 additions & 2 deletions src/tests/capture_replay_tests/GPGMMCaptureReplayTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ struct TestEnviromentParams {
uint64_t Iterations = 1; // Number of test iterations to run.
int CaptureEventMask = 0;

bool IsSameCapsRequired = false; // Caps of test device must match capture caps.
bool IsIgnoreCapsMismatchEnabled = false; // Test device must match capture caps.
bool IsSuballocationDisabled = false;
bool IsNeverAllocate = false;
bool IsPrefetchAllowed = false;
bool IsAllocationPlaybackDisabled = false; // Disables creation of new allocations.
bool IsAllocatorDisabled = false; // Disables creation of new allocations.
bool IsMemoryDisabled = false; // Disables creation of captured heaps.

AllocatorProfile AllocatorProfile =
AllocatorProfile::ALLOCATOR_PROFILE_CAPTURED; // Playback uses captured settings.
Expand Down