Skip to content
Merged
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: 4 additions & 2 deletions StabilityMatrix.Core/Models/Packages/ComfyUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ await StandardPipInstallProcessAsync(
var indexUrl = gfxArch switch
{
"gfx1151" => "https://rocm.nightlies.amd.com/v2/gfx1151",
_ when gfxArch.StartsWith("gfx110") => "https://rocm.nightlies.amd.com/v2/gfx110X-dgpu",
_ when gfxArch.StartsWith("gfx110") => "https://rocm.nightlies.amd.com/v2/gfx110X-all",
_ when gfxArch.StartsWith("gfx120") => "https://rocm.nightlies.amd.com/v2/gfx120X-all",
_ => throw new ArgumentOutOfRangeException(
nameof(gfxArch),
Expand Down Expand Up @@ -870,6 +870,8 @@ private ImmutableDictionary<string, string> GetEnvVars(ImmutableDictionary<strin
// set some experimental speed improving env vars for Windows ROCm
return env.SetItem("PYTORCH_TUNABLEOP_ENABLED", "1")
.SetItem("MIOPEN_FIND_MODE", "2")
.SetItem("TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL", "1");
.SetItem("TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL", "1")
.SetItem("PYTORCH_ALLOC_CONF", "max_split_size_mb:6144,garbage_collection_threshold:0.8") // greatly helps prevent GPU OOM and instability/driver timeouts/OS hard locks and decreases dependency on Tiled VAE at standard res's
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line contains magic numbers (6144, 0.8) and a very long comment, which can impact readability and maintainability.

I recommend extracting the numeric values into named constants to make their purpose explicit and easier to modify in the future. For example:

private const int PytorchAllocMaxSplitSizeMb = 6144;
private const double PytorchAllocGcThreshold = 0.8;

Additionally, the comment should be wrapped to fit within standard line length limits. I've provided a suggestion for reformatting the comment. Please consider applying the constants as well.

            // Greatly helps prevent GPU OOM, instability, driver timeouts, and OS hard locks.
            // It also decreases dependency on Tiled VAE at standard resolutions.
            .SetItem("PYTORCH_ALLOC_CONF", "max_split_size_mb:6144,garbage_collection_threshold:0.8")

.SetItem("COMFYUI_USE_MIOPEN", "1"); // re-enables "cudnn" in ComfyUI as it's needed for MiOpen to function properly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This comment is quite long and makes the line exceed typical length recommendations. For better readability, it's good practice to place comments on their own line(s) above the code they refer to, especially when they are descriptive.

            // Re-enables "cudnn" in ComfyUI as it's needed for MIOpen to function properly.
            .SetItem("COMFYUI_USE_MIOPEN", "1");

}
}
Loading