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

Fix Metal Support #95

Merged
merged 3 commits into from
Jun 10, 2023
Merged

Fix Metal Support #95

merged 3 commits into from
Jun 10, 2023

Conversation

soleblaze
Copy link
Contributor

@soleblaze soleblaze commented Jun 10, 2023

This fixes the make file so that the object files are created via the build directory instead of in llama.cpp. This fixes the issue where libbinding.a had no knowledge of metal. #91

I also updated the example instructions for metal so that they work properly.

Making these libraries outside of the build directory causes them to
have no knowledge that we're using metal. This prevents metal
acceleration from working. Using the cmake build directory fixes this
issue.
This example failed to load metal due to it missing the SetGPULayers
option.

I also updated the instructions to use go build instead of go run. This
is due to go run not loading the ggml-metal.metal file. I was unable to
get this working. Compiling it and running ./main will load the
ggml-metal.metal file in the CWD.
@soleblaze soleblaze changed the title Fix Metal Support (#91) Fix Metal Support Jun 10, 2023
@mudler
Copy link
Member

mudler commented Jun 10, 2023

Thanks @soleblaze ! nice catch!

@mudler
Copy link
Member

mudler commented Jun 10, 2023

ok weird, CI on mac fails 🤔

For this to compile properly using metal we need to set some CGO_LDFLAGS
so it can find the appropriate frameworks.
@mudler
Copy link
Member

mudler commented Jun 10, 2023

Fantastic, awesome job @soleblaze !

@@ -145,6 +145,7 @@ endif

ifeq ($(BUILD_TYPE),metal)
EXTRA_LIBS=
CGO_LDFLAGS+="-framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders"
Copy link
Member

Choose a reason for hiding this comment

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

🤦 feeling guilty, good catch!

@mudler mudler merged commit 53d9b57 into go-skynet:master Jun 10, 2023
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