Skip to content

Commit bc23fcd

Browse files
mmhusTameem-10xE
authored andcommitted
added support for RISCV CFLAGS & native compile + cross compile options
1 parent 92d0b75 commit bc23fcd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ ifndef UNAME_M
3535
UNAME_M := $(shell uname -m)
3636
endif
3737

38+
ifdef RISCV_CROSS_COMPILE
39+
CC := riscv64-unknown-linux-gnu-gcc
40+
CXX := riscv64-unknown-linux-gnu-g++
41+
endif
42+
3843
CCV := $(shell $(CC) --version | head -n 1)
3944
CXXV := $(shell $(CXX) --version | head -n 1)
4045

@@ -145,6 +150,9 @@ endif
145150
# Architecture specific
146151
# TODO: probably these flags need to be tweaked on some architectures
147152
# feel free to update the Makefile for your architecture and send a pull request or issue
153+
154+
ifndef RISCV
155+
148156
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
149157
# Use all CPU extensions that are available:
150158
CFLAGS += -march=native -mtune=native
@@ -193,6 +201,11 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
193201
endif
194202
endif
195203

204+
else
205+
CFLAGS += -march=rv64gcv -mabi=lp64d
206+
CXXFLAGS += -march=rv64gcv -mabi=lp64d
207+
endif
208+
196209
ifndef LLAMA_NO_K_QUANTS
197210
CFLAGS += -DGGML_USE_K_QUANTS
198211
CXXFLAGS += -DGGML_USE_K_QUANTS

0 commit comments

Comments
 (0)