From 89595ff4e5e60ec53da44f8cfd7d91e1766ffdc8 Mon Sep 17 00:00:00 2001 From: Aaryaman Vasishta Date: Sat, 9 Sep 2023 04:30:12 +0900 Subject: [PATCH] CUDA: enable option for F16 with LLAMA_HIPBLAS --- CMakeLists.txt | 4 ++++ Makefile | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6242dc31..e1e37a2dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -392,6 +392,10 @@ if (LLAMA_HIPBLAS) set_source_files_properties(ggml-cuda.cu PROPERTIES LANGUAGE CXX) target_link_libraries(ggml-rocm PRIVATE hip::device PUBLIC hip::host roc::rocblas roc::hipblas) + if (LLAMA_CUDA_F16) + add_compile_definitions(GGML_CUDA_F16) + endif() + if (LLAMA_STATIC) message(FATAL_ERROR "Static linking not supported for HIP/ROCm") endif() diff --git a/Makefile b/Makefile index a774dc50f..d5d2b7d65 100644 --- a/Makefile +++ b/Makefile @@ -412,6 +412,9 @@ ifdef LLAMA_HIPBLAS ifdef LLAMA_CUDA_FORCE_DMMV HIPFLAGS += -DGGML_CUDA_FORCE_DMMV endif # LLAMA_CUDA_FORCE_DMMV +ifdef LLAMA_CUDA_F16 + HIPFLAGS += -DGGML_CUDA_F16 +endif # LLAMA_CUDA_F16 OBJS += ggml-cuda.o ggml-cuda.o: ggml-cuda.cu ggml-cuda.h $(HIPCC) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $<