Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable memory defragmentation on ANV #4434

Merged
merged 1 commit into from
Nov 11, 2024
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
3 changes: 2 additions & 1 deletion dxvk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,10 @@
#
# Supported values:
# - True: Enable defragmentation
# - Auto: Enable defragmentation, except on blocked drivers
# - False: Disable defragmentation

# dxvk.enableMemoryDefrag = True
# dxvk.enableMemoryDefrag = Auto


# Sets enabled HUD elements
Expand Down
8 changes: 7 additions & 1 deletion src/dxvk/dxvk_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,13 @@ namespace dxvk {
m_memTypes[i].sharedCache->cleanupUnusedFromLockedAllocator(currentTime);
}

if (m_device->config().enableMemoryDefrag) {
// For unknown reasons, defragmentation seems to break Genshin Impact and
// possibly other games on ANV while working fine on other drivers even in
// a stress-test scenario, see https://github.com/doitsujin/dxvk/issues/4395.
bool enableDefrag = !m_device->adapter()->matchesDriver(VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA);
applyTristate(enableDefrag, m_device->config().enableMemoryDefrag);

if (enableDefrag) {
// Periodically defragment device-local memory types. We cannot
// do anything about mapped allocations since we rely on pointer
// stability there.
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/dxvk_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace dxvk {
DxvkOptions::DxvkOptions(const Config& config) {
enableDebugUtils = config.getOption<bool> ("dxvk.enableDebugUtils", false);
enableStateCache = config.getOption<bool> ("dxvk.enableStateCache", true);
enableMemoryDefrag = config.getOption<bool> ("dxvk.enableMemoryDefrag", true);
enableMemoryDefrag = config.getOption<Tristate>("dxvk.enableMemoryDefrag", Tristate::Auto);
numCompilerThreads = config.getOption<int32_t> ("dxvk.numCompilerThreads", 0);
enableGraphicsPipelineLibrary = config.getOption<Tristate>("dxvk.enableGraphicsPipelineLibrary", Tristate::Auto);
trackPipelineLifetime = config.getOption<Tristate>("dxvk.trackPipelineLifetime", Tristate::Auto);
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/dxvk_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace dxvk {
bool enableStateCache = true;

/// Enable memory defragmentation
bool enableMemoryDefrag = true;
Tristate enableMemoryDefrag = Tristate::Auto;

/// Number of compiler threads
/// when using the state cache
Expand Down