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

LoongArch64: Rename core #4900

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

XiWeiGu
Copy link
Contributor

@XiWeiGu XiWeiGu commented Sep 20, 2024

The current naming convention is not a very formal expression. After the revision, both the CPU name and Core name will be represented by the LA64 microarchitecture.
The definition of CPU name is as follows, which includes the currently known LA64 microarchitectures, representing the microarchitecture of the current host:

static char *cpuname[] = {
  "LA64_GENERIC",
  "LA264", /* Loongarch 64-bit, 2-issue, similar to 2K1000LA */
  "LA364", /* Loongarch 64-bit, 3-issue, similar to 2K2000 */
  "LA464", /* Loongarch 64-bit, 4-issue, similar to 3A5000, 3C5000L, 3C5000, and 3D5000 */
  "LA664"  /* Loongarch 64-bit, 6-issue, similar to 3A6000, 3C6000, and 3D6000 */
};

The definition of Core name is as follows, representing the LA64 microarchitecture related to the instruction set, which reflects the selected optimization type:

static char *corename[] = {
  "LA64_GENERIC", /* Represents optimization using scalar instructions */
  "LA264", /* Represents optimization using LSX instructions */
  "LA464", /* Represents optimization using LASX instructions */
};

Among these, LA64_GENERIC is related to scalar optimizations; LA264 corresponds to LSX instruction optimizations; and LA464 corresponds to LASX instruction optimizations.

The core is selected based on the CPU name and the instruction set supported by the system.

For LA364, although it supports LSX instructions, it lacks additional extensions. Currently, there is no need for further optimization of the existing LSX instructions. Therefore, no new core is required, and the LA264 optimization approach can be reused. Similarly, this principle applies to LA664. This approach has the advantage of reducing compilation time and code size when DYNAMIC_ARCH=1 is enabled.

Taking 3A6000 as an example, its CPU name is LA664, while its Core name is LA464 because it shares the same optimization approach as LA464.

The addition of a new CPU name is based on the emergence of new LA64 microarchitectures, while a new Core name is added only when the new LA64 microarchitecture introduces a new instruction set or other significant performance optimizations. This approach helps prevent code bloat while ensuring streamlined and efficient optimization code.

@XiWeiGu
Copy link
Contributor Author

XiWeiGu commented Sep 20, 2024

@yinshiyou @martin-frbg @azuresky01 @Pengzhou0810 Could you help me review the code to see if there are any missing parts? Thanks!

Use microarchitecture name instead of meaningless strings to name the core
1. Rename LOONGSONGENERIC to LA64_GENERIC
2. Rename LOONGSON3R5 to LA464
3. Rename LOONGSON2K1000 t0 LA264
@martin-frbg
Copy link
Collaborator

I must say I am not particularly happy with renaming TARGET entries that have been in use for quite a while. Can we at least keep the present names as aliases so that users and distributors will not have to change their build scripts (and whatever local documentation there may be out there) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants