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

llama-cpp: Add new b4570 version #26477

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

AbrilRBS
Copy link
Member

Summary

Changes to recipe: llama-cpp/b4570

Motivation

We wanted to use it in a future blogpost

Details

Lots of changes for this new version, so the package_info is split in two: the old one, and the new one. Maybe it would be better to remove the old versions from the conandata and just keep this new version, but thought that the current approach is a bit better until we can decide

@AbrilRBS AbrilRBS requested a review from czoido January 28, 2025 17:07
@jcar87 jcar87 self-assigned this Jan 28, 2025
Comment on lines 118 to 121
if is_apple_os(self):
self.cpp_info.components["common"].frameworks.extend(["Foundation", "Accelerate", "Metal"])
elif self.settings.os in ("Linux", "FreeBSD"):
self.cpp_info.components["common"].system_libs.extend(["dl", "m", "pthread", "gomp"])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this code is common for all versions?

self.cpp_info.components["common"].requires = ["llama"]
if self.options.with_curl:
self.cpp_info.components["common"].requires.append("libcurl::libcurl")
self.cpp_info.components["common"].defines.append("LLAMA_USE_CURL")
Copy link
Contributor

@czoido czoido Jan 29, 2025

Choose a reason for hiding this comment

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

I think we don't need to define this in the package_info?

Copy link
Member Author

Choose a reason for hiding this comment

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

Upstream's CMakeLists contains target_compile_definitions(${TARGET} PUBLIC LLAMA_USE_CURL) with TARGET being common

Copy link
Contributor

Choose a reason for hiding this comment

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

And is this new from this version or should we add it to the old versions too?

Comment on lines 115 to 116
if self.options.with_curl:
self.cpp_info.components["common"].requires.append("libcurl::libcurl")
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be defined for both versions?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, because if no requires is explicitly defined, all components get all the library requirements. I can be more explicity to avoid overlinking in old versions

if Version(self.version) >= "b4570":
self.cpp_info.components["common"].includedirs = [os.path.join("include", "common")]
self.cpp_info.components["common"].libs = ["common"]
self.cpp_info.components["common"].requires = ["llama"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this true? I'm not sure that llama requires common, this requires was not defined for previous versions

Copy link
Member Author

Choose a reason for hiding this comment

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

target_link_libraries (${TARGET} PRIVATE ${LLAMA_COMMON_EXTRA_LIBS} PUBLIC llama Threads::Threads) with TARGET being common here too

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems like it was missing for the old versions too, as this same line is present in the previous version too

Comment on lines 112 to 113
self.cpp_info.components["common"].includedirs = [os.path.join("include", "common")]
self.cpp_info.components["common"].libs = ["common"]
Copy link
Contributor

Choose a reason for hiding this comment

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

We can move this out from the if Version and use for all versions

Comment on lines 155 to 158
if self.options.with_cuda and not self.options.shared:
self.cpp_info.builddirs.append(os.path.join("lib", "cmake"))
module_path = os.path.join("lib", "cmake", "llama-cpp-cuda-static.cmake")
self.cpp_info.set_property("cmake_build_modules", [module_path])
Copy link
Contributor

Choose a reason for hiding this comment

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

this can also be shared between both versions

"b4079":
- patch_file: "patches/b4079-001-curl-patch-targets.patch"
"b3542":
- patch_file: "patches/b3542-001-curl-patch-targets.patch"
"b3040":
Copy link
Contributor

Choose a reason for hiding this comment

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

This version had a slightly different logic, because did not have the ggml component so it the recipe was a bit cleaner removing this, and it's also quiet outdated

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.

3 participants