Skip to content

Commit

Permalink
changes to fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
YellowRoseCx committed Jun 29, 2023
1 parent c9e1103 commit 2c3b46f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
28 changes: 15 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,22 @@ ifdef LLAMA_CUDA_KQUANTS_ITER
else
CXXFLAGS += -DK_QUANTS_PER_ITERATION=2
endif
ggml-cuda.o:
CXXFLAGS += $(addprefix --offload-arch=,$(GPU_TARGETS)) \
-DGGML_CUDA_DMMV_X=$(LLAMA_CUDA_DMMV_X) \
-DGGML_CUDA_DMMV_Y=$(LLAMA_CUDA_DMMV_Y)

ggml-cuda.o: CXXFLAGS += $(addprefix --offload-arch=,$(GPU_TARGETS)) \
-DGGML_CUDA_DMMV_X=$(LLAMA_CUDA_DMMV_X) \
-DGGML_CUDA_DMMV_Y=$(LLAMA_CUDA_DMMV_Y)
# DGGML_CUDA_DMMV_F16 does not currently work with AMD.
ggml-cuda.o: ggml-cuda.cu ggml-cuda.h
$(CXX) $(CXXFLAGS) -x hip -c -o $@ $<
$(CXX) $(CXXFLAGS) -x hip -c -o $@ $<

ggml_v2-cuda.o: otherarch/ggml_v2-cuda.cu otherarch/ggml_v2-cuda.h
$(CXX) $(CXXFLAGS) -x hip -c -o $@ $<
ggml_v2-cuda-legacy.o: otherarch/ggml_v2-cuda-legacy.cu otherarch/ggml_v2-cuda-legacy.h
$(CXX) $(CXXFLAGS) -x hip -c -o $@ $<
$(CXX) $(CXXFLAGS) -x hip -c -o $@ $<

ggml_v2-cuda-legacy.o: otherarch/ggml_v2-cuda-legacy.cu otherarch/ggml_v2-cuda-legacy.h
$(CXX) $(CXXFLAGS) -x hip -c -o $@ $<
endif # LLAMA_HIPBLAS


ifdef LLAMA_METAL
CFLAGS += -DGGML_USE_METAL -DGGML_METAL_NDEBUG
CXXFLAGS += -DGGML_USE_METAL
Expand Down Expand Up @@ -253,11 +255,11 @@ else
OPENBLAS_NOAVX2_BUILD = $(CXX) $(CXXFLAGS) $^ $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS)
endif
ifdef LLAMA_CLBLAST
ifeq ($(UNAME_S),Darwin)
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -framework OpenCL $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS)
else
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -lOpenCL $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS)
endif
ifeq ($(UNAME_S),Darwin)
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -framework OpenCL $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS)
else
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -lOpenCL $(ARCH_ADD) -lopenblas -shared -o $@.so $(LDFLAGS)
endif
endif

ifdef LLAMA_CUBLAS
Expand Down
5 changes: 3 additions & 2 deletions otherarch/gptj_v3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

#ifdef GGML_USE_CUBLAS
#include "ggml-cuda.h"
#elif defined(GGML_USE_CLBLAST)
#endif
#if defined(GGML_USE_CLBLAST)
#include "ggml-opencl.h"
#endif

Expand Down Expand Up @@ -639,4 +640,4 @@ bool gptj_eval(
ggml_free(ctx0);

return true;
}
}
5 changes: 3 additions & 2 deletions otherarch/llama_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include "ggml_v2.h"
#ifdef GGML_USE_CUBLAS
#include "ggml_v2-cuda.h"
#elif defined(GGML_USE_CLBLAST)
#endif
#if defined(GGML_USE_CLBLAST)
#include "ggml_v2-opencl.h"
#endif

Expand Down Expand Up @@ -3098,4 +3099,4 @@ std::vector<llama_token> llama_v2_tokenize(struct llama_v2_context * ctx, const
res.resize(n);

return res;
}
}
3 changes: 2 additions & 1 deletion otherarch/mpt_v3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

#ifdef GGML_USE_CUBLAS
#include "ggml-cuda.h"
#elif defined(GGML_USE_CLBLAST)
#endif
#if defined(GGML_USE_CLBLAST)
#include "ggml-opencl.h"
#endif

Expand Down
5 changes: 3 additions & 2 deletions otherarch/neox_v3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

#ifdef GGML_USE_CUBLAS
#include "ggml-cuda.h"
#elif defined(GGML_USE_CLBLAST)
#endif
#if defined(GGML_USE_CLBLAST)
#include "ggml-opencl.h"
#endif

Expand Down Expand Up @@ -658,4 +659,4 @@ bool gpt_neox_eval(
ggml_free(ctx0);

return true;
}
}

0 comments on commit 2c3b46f

Please sign in to comment.