@@ -91,11 +91,15 @@ build/train_gpt2: llm.c build/unittest_kernels.o gpt2_124M.bin
91
91
$(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ llm.c/train_gpt2.c build/unittest_kernels.o
92
92
93
93
build/ops.o : ops.cpp ops.hpp kernels.h
94
- mkdir -p build && $(CXX ) $(CXXFLAGS ) -DNDEBUG -c -o $@ $<
94
+ mkdir -p build && $(CXX ) $(CXXFLAGS ) -g -c -o $@ $<
95
+
96
+ # build/gpt2_webgpu: llm.c build/ops.o gpt2_124M.bin
97
+ # mkdir -p build
98
+ # $(CC) -g $(CXXFLAGS) -Illm.c $(LDFLAGS) -o $@ gpt2_webgpu.cpp build/ops.o
95
99
96
- build/gpt2_webgpu : llm.c build/ops.o gpt2_124M.bin
100
+ build/gpt2_webgpu : llm.c gpt2_124M.bin
97
101
mkdir -p build
98
- $(CC ) -g $(CXXFLAGS ) -Illm.c $(LDFLAGS ) -o $@ gpt2_webgpu.cpp build/ ops.o
102
+ $(CC ) -g $(CXXFLAGS ) -Illm.c $(LDFLAGS ) -o $@ gpt2_webgpu.cpp ops.cpp
99
103
100
104
build/test_gpt2.html : check-emsdk run.cpp term.html build/test_gpt2
101
105
em++ llm.c/test_gpt2.c unittest_llmc/unittest_kernels.cpp \
@@ -119,22 +123,14 @@ build/train_gpt2.html: check-emsdk run.cpp term.html build/train_gpt2
119
123
$(EMFLAGS ) \
120
124
--shell-file term.html \
121
125
122
- build/gpt2_gpucpp.html : check-emsdk run.cpp term.html build/train_gpt2
123
- em++ gpt2_webgpu.cpp unittest_llmc/unittest_kernels.cpp \
124
- --preload-file gpt2_tokenizer.bin@/gpt2_tokenizer.bin \
125
- --preload-file gpt2_124M.bin@/gpt2_124M.bin \
126
- --preload-file gpt2_124M_debug_state.bin@/gpt2_124M_debug_state.bin \
127
- --preload-file llm.c/dev/data/tinyshakespeare/tiny_shakespeare_train.bin@dev/data/tinyshakespeare/tiny_shakespeare_train.bin \
128
- --preload-file llm.c/dev/data/tinyshakespeare/tiny_shakespeare_val.bin@dev/data/tinyshakespeare/tiny_shakespeare_val.bin \
129
- -o build/gpt2_gpucpp.html \
130
- $(EMFLAGS ) \
131
- --shell-file term.html \
132
-
133
126
watch-web :
134
- ls * .cpp * .c * .hpp * .h | entr -c make build/gpt2_gpucpp.html
127
+ ls * .cpp * .c * .hpp * .h | entr -s make build/gpt2_gpucpp.html
135
128
136
129
watch-native :
137
- ls * .cpp * .c * .hpp * .h | entr -c make build/train_gpt2
130
+ ls * .cpp * .c * .hpp * .h | entr -s " rm -f build/gpt2_webgpu && rm -f build/ops.o && make build/gpt2_webgpu"
131
+
132
+ run-native : build/gpt2_webgpu
133
+ . $(GPUCPP ) /source && ./build/gpt2_webgpu
138
134
139
135
server : build/train_gpt2.html build/test_gpt2.html build/gpt2_gpucpp.html
140
136
@echo " \n┌───────────────────────────────────────────────────────────────────────────────────┐"
@@ -152,11 +148,11 @@ dawnlib: $(if $(wildcard $(GPUCPP)/third_party/lib/libdawn.so $(GPUCPP)/third_pa
152
148
run_setup : check-python
153
149
cd $(GPUCPP ) && python3 setup.py
154
150
155
- build/$(TARGET ) : run.cpp
156
- mkdir -p build && $(CXX ) $(FLAGS ) -DNDEBUG -o $@ $<
151
+ # build/$(TARGET): run.cpp
152
+ # mkdir -p build && $(CXX) $(FLAGS) -DNDEBUG -o $@ $<
157
153
158
- debug : run.cpp
159
- mkdir -p build && $(CXX ) $(FLAGS ) -g -o ./build/$(TARGET ) $<
154
+ # debug: run.cpp
155
+ # mkdir -p build && $(CXX) $(FLAGS) -g -o ./build/$(TARGET) $<
160
156
161
157
clean :
162
158
read -r -p " This will delete the contents of build/*. Are you sure? [CTRL-C to abort] " response && rm -rf build/*
0 commit comments