File tree Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Original file line number Diff line number Diff line change 40
40
41
41
LDFLAGS = -L$(XLA_EXTENSION_LIB ) -lxla_extension -shared
42
42
43
- ifeq ($(shell uname -s) , Darwin)
43
+ ifeq ($(CROSSCOMPILE ) ,)
44
+ # Interrogate the system for local compilation
45
+ UNAME_S = $(shell uname -s)
46
+
47
+ NVCC_RESULT := $(shell which nvcc 2> /dev/null)
48
+ NVCC_TEST := $(notdir $(NVCC_RESULT))
49
+
50
+ ifeq ($(NVCC_TEST ) ,nvcc)
51
+ NVCC := nvcc
52
+ NVCCFLAGS += -DCUDA_ENABLED
53
+ else
54
+ NVCC := $(CXX)
55
+ NVCCFLAGS = $(CFLAGS)
56
+ endif
57
+ else
58
+ # Determine settings for cross-compiled builds like for Nerves
59
+ UNAME_S = Linux
60
+ NVCC := $(CXX)
61
+ NVCCFLAGS = $(CFLAGS)
62
+ endif
63
+
64
+ ifeq ($(UNAME_S ) , Darwin)
44
65
LDFLAGS += -flat_namespace -undefined dynamic_lookup -rpath @loader_path/xla_extension/lib
45
66
else
46
67
# Use a relative RPATH, so at runtime libexla.so looks for libxla_extension.so
@@ -67,17 +88,6 @@ HEADERS = $(EXLA_DIR)/exla_mlir.h $(EXLA_DIR)/custom_calls/qr.h $(EXLA_DIR)/cust
67
88
OBJECTS = $(patsubst $(EXLA_DIR ) /% .cc,$(EXLA_CACHE_OBJ_DIR ) /% .o,$(SOURCES ) ) $(EXLA_CACHE_OBJ_DIR ) /exla_cuda.o
68
89
69
90
70
- NVCC_RESULT := $(shell which nvcc 2> /dev/null)
71
- NVCC_TEST := $(notdir $(NVCC_RESULT ) )
72
-
73
- ifeq ($(NVCC_TEST ) ,nvcc)
74
- NVCC := nvcc
75
- NVCCFLAGS += -DCUDA_ENABLED
76
- else
77
- NVCC := $(CXX )
78
- NVCCFLAGS = $(CFLAGS)
79
- endif
80
-
81
91
$(EXLA_CACHE_OBJ_DIR ) /exla_cuda.o : $(EXLA_DIR ) /exla_cuda.cc $(EXLA_DIR ) /exla_cuda.h
82
92
@ mkdir -p $(EXLA_CACHE_OBJ_DIR )
83
93
$(NVCC ) $(NVCCFLAGS ) -c $< -o $@
You can’t perform that action at this time.
0 commit comments