Skip to content

Commit 21ca261

Browse files
roberteg16claude
andcommitted
ggml-cuda: enable the shared-expert overlap by default on RDNA3.5
GGML_CUDA_GRAPH_OPT still forces the optimization on ("1") or off ("0"), but when it is unset the default is now on for RDNA3.5 - the architecture where the decode-time shared-expert overlap has been tuned - and off everywhere else. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
1 parent ec45ac3 commit 21ca261

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

ggml/src/ggml-cuda/ggml-cuda.cu

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4701,11 +4701,17 @@ static void ggml_backend_cuda_graph_optimize(ggml_backend_t backend, ggml_cgraph
47014701
GGML_UNUSED(cgraph);
47024702
#endif
47034703

4704-
static bool enable_graph_optimization = [] {
4705-
const char * env = getenv("GGML_CUDA_GRAPH_OPT");
4706-
return env != nullptr && atoi(env) == 1;
4704+
// GGML_CUDA_GRAPH_OPT: "1"/"0" force the optimization on/off; when unset it defaults on for
4705+
// RDNA3.5, the only architecture where the decode-time overlap has been tuned, and off elsewhere.
4706+
static const int graph_opt_env = [] {
4707+
const char * env = getenv("GGML_CUDA_GRAPH_OPT");
4708+
return env == nullptr ? -1 : atoi(env);
47074709
}();
47084710

4711+
const bool enable_graph_optimization = graph_opt_env >= 0 ?
4712+
graph_opt_env == 1 :
4713+
GGML_CUDA_CC_IS_RDNA3_5(ggml_cuda_info().devices[cuda_ctx->device].cc);
4714+
47094715
if (!enable_graph_optimization) {
47104716
return;
47114717
}

0 commit comments

Comments
 (0)