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

cmake: Enable specifying exact PowerPC CPU architecture #1138

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

ckastner
Copy link
Contributor

@ckastner ckastner commented Mar 10, 2025

Useful for when build host != use host. For example Debian's build daemons build packages for other hosts, so we want to target their CPUs, and not the build daemon's.

https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#index-mcpu-10

Copy link
Member

@slaren slaren left a comment

Choose a reason for hiding this comment

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

For consistency, automatic CPU detection should be enabled with GGML_NATIVE:

if (GGML_NATIVE)
    # detect CPU
else()
    if (GGML_CPU_POWERPC_CPUTYPE)
        list(APPEND ARCH_FLAGS -mcpu=${GGML_CPU_POWERPC_CPUTYPE})
    endif()
endif()

Comment on lines +129 to +130
set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM")
set(GGML_CPU_POWERPC_CPUTYPE "" CACHE STRING "ggml: CPU type for PowerPC")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should consolidate all of these into a single option in the future, but it's not important right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to propose something once I've done more of a deep dive into other architectures. I'm not yet that familiar with the nuances of the other architectures, or how they would map. For example, -march vs. PowerPC's -mcpu and -mtune.

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure either, but probably an option to set the value of -march or -mcpu would work well enough in most cases.

@slaren slaren merged commit 2efc170 into ggml-org:master Mar 10, 2025
3 checks passed
@ckastner ckastner deleted the powerpc-cpu branch March 10, 2025 18:24
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