Skip to content

Commit 89f0829

Browse files
author
mike dupont
committed
still not working
1 parent e9c13ff commit 89f0829

18 files changed

+2823
-528
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,6 @@ tests/test-tokenizer-0-llama
9999
tests/test-tokenizer-0-falcon
100100
tests/test-tokenizer-1-llama
101101
tests/test-tokenizer-1-bpe
102+
/#llama.cpp#
103+
#*
104+
\\#*

CMakeLists.txt

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ option(LLAMA_BUILD_SERVER "llama: build server example"
104104
# Compile flags
105105
#
106106

107-
set(CMAKE_CXX_STANDARD 11)
107+
set(CMAKE_CXX_STANDARD 20)
108108
set(CMAKE_CXX_STANDARD_REQUIRED true)
109109
set(CMAKE_C_STANDARD 11)
110110
set(CMAKE_C_STANDARD_REQUIRED true)
@@ -230,7 +230,12 @@ if (LLAMA_BLAS)
230230

231231
message(STATUS "BLAS found, Includes: ${BLAS_INCLUDE_DIRS}")
232232
add_compile_options(${BLAS_LINKER_FLAGS})
233-
add_compile_definitions(GGML_USE_OPENBLAS)
233+
234+
# from https://github.com/NVIDIA/cutlass
235+
make_directory("${PROJECT_BINARY_DIR}/nvcc_tmp")
236+
set(cuda_flags --keep "SHELL:--keep-dir ${PROJECT_BINARY_DIR}/nvcc_tmp" ${cuda_flags})
237+
238+
# add_compile_definitions(GGML_USE_OPENBLAS)
234239
if (${BLAS_INCLUDE_DIRS} MATCHES "mkl" AND (${LLAMA_BLAS_VENDOR} MATCHES "Generic" OR ${LLAMA_BLAS_VENDOR} MATCHES "Intel"))
235240
add_compile_definitions(GGML_BLAS_USE_MKL)
236241
endif()
@@ -312,7 +317,7 @@ if (LLAMA_MPI)
312317
if (MPI_C_FOUND)
313318
message(STATUS "MPI found")
314319
set(GGML_HEADERS_MPI ggml-mpi.h)
315-
set(GGML_SOURCES_MPI ggml-mpi.c ggml-mpi.h)
320+
set(GGML_SOURCES_MPI ggml-mpi.cpp ggml-mpi.h)
316321
add_compile_definitions(GGML_USE_MPI)
317322
add_compile_definitions(${MPI_C_COMPILE_DEFINITIONS})
318323
if (NOT MSVC)
@@ -438,6 +443,9 @@ if (NOT cuda_host_flags STREQUAL "")
438443
set(cuda_flags ${cuda_flags} -Xcompiler ${cuda_host_flags})
439444
endif()
440445

446+
#
447+
set(cuda_flags --verbose -G ${cuda_flags})
448+
441449
add_compile_options("$<$<COMPILE_LANGUAGE:CUDA>:${cuda_flags}>")
442450

443451
if (WIN32)
@@ -485,8 +493,10 @@ if (NOT MSVC)
485493
add_link_options(-static-libgcc -static-libstdc++)
486494
endif()
487495
endif()
496+
add_link_options("-Wl,-Map=${TARGET}.map")
497+
488498
if (LLAMA_GPROF)
489-
add_compile_options(-pg)
499+
add_compile_options(-pg)
490500
endif()
491501
endif()
492502

@@ -645,13 +655,16 @@ if (GGML_USE_CPU_HBM)
645655
endif()
646656

647657
add_library(ggml OBJECT
648-
ggml.c
658+
ggml.cpp
649659
ggml.h
650-
ggml-alloc.c
660+
print.hpp
661+
ggml-internal.hpp
662+
llama-internal.hpp
663+
ggml-alloc.cpp
651664
ggml-alloc.h
652-
ggml-backend.c
665+
ggml-backend.cpp
653666
ggml-backend.h
654-
ggml-quants.c
667+
ggml-quants.cpp
655668
ggml-quants.h
656669
${GGML_SOURCES_CUDA} ${GGML_HEADERS_CUDA}
657670
${GGML_SOURCES_OPENCL} ${GGML_HEADERS_OPENCL}
@@ -683,7 +696,7 @@ add_library(llama
683696
)
684697

685698
target_include_directories(llama PUBLIC .)
686-
target_compile_features(llama PUBLIC cxx_std_11) # don't bump
699+
target_compile_features(llama PUBLIC cxx_std_20) # don't bump
687700
target_link_libraries(llama PRIVATE
688701
ggml
689702
${LLAMA_EXTRA_LIBS}

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ endif
116116
# keep standard at C11 and C++11
117117
MK_CPPFLAGS = -I. -Icommon
118118
MK_CFLAGS = -std=c11 -fPIC
119-
MK_CXXFLAGS = -std=c++11 -fPIC
119+
MK_CXXFLAGS = -std=c++20 -fPIC -fpermissive -DCPP_ONLY
120120

121121
# -Ofast tends to produce faster code, but may not be available for some compilers.
122122
ifdef LLAMA_FAST
@@ -502,7 +502,7 @@ ggml-metal.o: ggml-metal.m ggml-metal.h
502502
endif # LLAMA_METAL
503503

504504
ifdef LLAMA_MPI
505-
ggml-mpi.o: ggml-mpi.c ggml-mpi.h
505+
ggml-mpi.o: ggml-mpi.cpp ggml-mpi.h
506506
$(CC) $(CFLAGS) -c $< -o $@
507507
endif # LLAMA_MPI
508508

@@ -537,17 +537,17 @@ $(info )
537537
# Build library
538538
#
539539

540-
ggml.o: ggml.c ggml.h ggml-cuda.h
541-
$(CC) $(CFLAGS) -c $< -o $@
540+
ggml.o: ggml.cpp ggml.h ggml-cuda.h
541+
$(CXX) $(CXXFLAGS) -c $< -o $@
542542

543-
ggml-alloc.o: ggml-alloc.c ggml.h ggml-alloc.h
544-
$(CC) $(CFLAGS) -c $< -o $@
543+
ggml-alloc.o: ggml-alloc.cpp ggml.h ggml-alloc.h
544+
$(CXX) $(CXXFLAGS) -c $< -o $@
545545

546-
ggml-backend.o: ggml-backend.c ggml.h ggml-backend.h
547-
$(CC) $(CFLAGS) -c $< -o $@
546+
ggml-backend.o: ggml-backend.cpp ggml.h ggml-backend.h
547+
$(CXX) $(CXXFLAGS) -c $< -o $@
548548

549-
ggml-quants.o: ggml-quants.c ggml.h ggml-quants.h
550-
$(CC) $(CFLAGS) -c $< -o $@
549+
ggml-quants.o: ggml-quants.cpp ggml.h ggml-quants.h
550+
$(CXX) $(CXXFLAGS) -c $< -o $@
551551

552552
OBJS += ggml-alloc.o ggml-backend.o ggml-quants.o
553553

@@ -734,5 +734,5 @@ tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMM
734734
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
735735
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
736736

737-
tests/test-c.o: tests/test-c.c llama.h
738-
$(CC) $(CFLAGS) -c $(filter-out %.h,$^) -o $@
737+
tests/test-c.o: tests/test-c.cpp llama.h
738+
$(CXX) $(CXXFLAGS) -c $(filter-out %.h,$^) -o $@

0 commit comments

Comments
 (0)