Cycles: Show CPU only name under Cycles devices for CPU

On APUs, cpuid returns a brand string that includes both CPU and GPU
information. For RDNA 3 and RDNA 3.5 parts, the pattern is
"cpu_info w/ gpu_info" (e.g., _AMD Ryzen 9 8940H w/ Radeon 780M Graphics_).
RDNA 2 APUs follow the same pattern using “with”.

Including GPU details in the CPU device option has caused confusion for some
users.

This pull request updates the logic to detect AMD in the brand string and
strips the GPU portion if it is part of the string. It checks for “w/” or
“with” and removes the trailing GPU information, leaving only the CPU name.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/151141
This commit is contained in:
salipour 2025-12-05 20:14:19 +01:00 • committed by Brecht Van Lommel
parent ebd978667a
commit be792137c0
4 changed files with 35 additions and 0 deletions

View file

@ -269,6 +269,21 @@ TEST(util_string_remove_trademark, r_space_middle)
EXPECT_EQ(str, "foo bar baz");
}
/* ******** Tests for string_remove_trademark() ******** */
TEST(util_string_remove_gpu_from_cpu_name, basic)
{
EXPECT_EQ(string_remove_gpu_from_cpu_name(""), "");
EXPECT_EQ(string_remove_gpu_from_cpu_name("My CPU"), "My CPU");
EXPECT_EQ(string_remove_gpu_from_cpu_name("AMD CPU w/ Graphics"), "AMD CPU");
EXPECT_EQ(string_remove_gpu_from_cpu_name("AMD CPU with Graphics"), "AMD CPU");
EXPECT_EQ(string_remove_gpu_from_cpu_name("My CPU w/ foo"), "My CPU w/ foo");
EXPECT_EQ(string_remove_gpu_from_cpu_name("My CPU with foo"), "My CPU with foo");
}
/* ******** Tests for string_startswith() ******** */
TEST(string_startswith, basic)

View file

@ -214,6 +214,24 @@ string string_to_lower(const string &s)
return r;
}
string string_remove_gpu_from_cpu_name(const string &s)
{
if (s.find("AMD") == std::string::npos) {
return s;
}
size_t pos = s.find("w/");
if (pos == std::string::npos) {
pos = s.find("with");
}
if (pos != std::string::npos) {
return string_strip(s.substr(0, pos));
}
return s;
}
/* Wide char strings helpers for Windows. */
#ifdef _WIN32

View file

@ -47,6 +47,7 @@ string string_hex(const uint8_t *data, const size_t size);
string to_string(const char *str);
string to_string(const float4 &v);
string string_to_lower(const string &s);
string string_remove_gpu_from_cpu_name(const string &s);
/* Wide char strings are only used on Windows to deal with non-ASCII
* characters in file names and such. No reason to use such strings

View file

@ -86,6 +86,7 @@ string system_cpu_brand_string()
/* Make it a bit more presentable. */
brand = string_remove_trademark(brand);
brand = string_remove_gpu_from_cpu_name(brand);
return brand;
}