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

cpu: add loongarch64 support #1923

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

Conversation

loong-hy
Copy link

@@ -74,10 +74,10 @@ oneDNN supports platforms based on the following architectures:
- [OpenPOWER](https://openpowerfoundation.org/) / [IBM Power ISA](https://en.wikipedia.org/wiki/Power_ISA).
- [IBMz z/Architecture (s390x)](https://en.wikipedia.org/wiki/Z/Architecture).
- [RISC-V 64-bit (RV64)](https://en.wikipedia.org/wiki/RISC-V).

- [LOONGARCH 64 bit](https://docs.kernel.org/arch/loongarch/introduction.html).
Copy link
Contributor

Choose a reason for hiding this comment

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

Please restore the new line to separate the warning.

// - DNNL_ARCH_GENERIC
// Target architecture macro is set to 1, others to 0. All macros are defined.

#if defined(DNNL_X64) + defined(DNNL_AARCH64) + defined(DNNL_PPC64) \
+ defined(DNNL_S390X) + defined(DNNL_RV64) \
+ defined(DNNL_S390X) + defined(DNNL_RV64) + defined(DNNL_LOONGARCH64) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Please apply clang-format on this file.

Copy link
Author

Choose a reason for hiding this comment

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

Please apply clang-format on this file.

It's been revised and resubmitted, thanks

Copy link
Contributor

@mgouicem mgouicem left a comment

Choose a reason for hiding this comment

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

thanks for the PR. I have few questions:

  • could you reword the commit message to align with oneDNN guidelines (see here. Something like cpu: add loongarch64 support should do.
  • In general, adding a new CPU to oneDNN platform.cmake is necessary only when isa specific optimization or fixes are added to the library. From the look of the patch, it does not seem to be the case for loongarch64 (this patch is equivalent to building the library with ONEDNN_ARCH_OPT_FLAGS=-march=loongarch64 cmake option). Do you have any plan to add loongarch64 isa specific code to oneDNN?

@@ -363,6 +363,8 @@ elseif(UNIX OR MINGW)
elseif(DNNL_TARGET_ARCH STREQUAL "RV64")
# G = General-purpose extensions, C = Compression extension (very common).
append(DEF_ARCH_OPT_FLAGS "-march=rv64gc")
elseif(DNNL_TARGET_ARCH STREQUAL "LOONGARCH64")
append(DEF_ARCH_OPT_FLAGS "-march=loongarch64")
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to not add opt flags for compilers other than gcc ?

@loong-hy loong-hy changed the title Add initial support for loongarch architecture cpu: add loongson architecture support May 22, 2024
@loong-hy
Copy link
Author

thanks for the PR. I have few questions:

  • could you reword the commit message to align with oneDNN guidelines (see here. Something like cpu: add loongarch64 support should do.

Hello, I have changed the commit as requested.

  • In general, adding a new CPU to oneDNN platform.cmake is necessary only when isa specific optimization or fixes are added to the library. From the look of the patch, it does not seem to be the case for loongarch64 (this patch is equivalent to building the library with ONEDNN_ARCH_OPT_FLAGS=-march=loongarch64 cmake option). Do you have any plan to add loongarch64 isa specific code to oneDNN?

Because I will add loongarch related code later, I didn't change it this time because of time constraints.

@loong-hy loong-hy changed the title cpu: add loongson architecture support cpu: add loongarch64 support May 22, 2024
@mgouicem
Copy link
Contributor

mgouicem commented Jun 5, 2024

@loong-hy do you mind submitting this patch as part of the future PR that will add loongarch specific code?
This will allow to introduce these knobs only when actually necessary. Thanks.

@loong-hy
Copy link
Author

loong-hy commented Jun 5, 2024

@loong-hy do you mind submitting this patch as part of the future PR that will add loongarch specific code? This will allow to introduce these knobs only when actually necessary. Thanks.

Sure, I'll revise and resubmit the code shortly, thanks!

@vpirogov vpirogov removed this from the v3.6 milestone Aug 22, 2024
@vpirogov vpirogov requested review from a team as code owners November 1, 2024 23:27
Copy link
Contributor

@ranukund ranukund left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

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

Successfully merging this pull request may close these issues.

5 participants