Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ops of AoT #70

Merged
merged 7 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions experimental/kernels/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CXXFLAGS=-std=c++17 -I$(GPUCPP) -I$(GPUCPP)/third_party/headers -I. -Iunittest_l
CFLAGS=-Ofast -march=native -I. -Iunittest_llmc
# CFLAGS=-O2 -march=native -I. -Iunittest_llmc

LDFLAGS=$(STDLIB) -L$(GPUCPP)/third_party/lib -ldl -ldawn
LDFLAGS=$(STDLIB) -L$(GPUCPP)/third_party/lib -ldl -ldawn -fsanitize=address
FLAGS=$(CXXFLAGS) $(LDFLAGS)

ifeq ($(shell [ -d /opt/homebrew/opt/libomp/lib ] && echo "exists"), exists)
Expand Down Expand Up @@ -99,6 +99,10 @@ build/gpt2_webgpu: llm.c gpt2_124M.bin llm.c gpt2_webgpu.cpp ops.cpp
mkdir -p build
$(CC) $(CXXFLAGS) -Illm.c $(LDFLAGS) -o $@ gpt2_webgpu.cpp ops.cpp

build/gpt2_webgpu_aot: llm.c gpt2_124M.bin llm.c gpt2_webgpu_aot.cpp ops_aot.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventually this will probably be the main gpt2_webgpu implementaiton, though this is fine for this PR

mkdir -p build
$(CC) $(CXXFLAGS) -Illm.c $(LDFLAGS) -o $@ gpt2_webgpu_aot.cpp ops_aot.cpp -g

build/gpt2_webgpu.html: check-emsdk gpt2_webgpu.cpp term.html llm.c
em++ gpt2_webgpu.cpp ops.cpp \
--preload-file gpt2_tokenizer.bin@/gpt2_tokenizer.bin \
Expand All @@ -116,8 +120,8 @@ watch-web:
watch-native:
ls *.cpp *.c *.hpp *.h | entr -s "rm -f build/gpt2_webgpu && rm -f build/ops.o && make build/gpt2_webgpu"

run-native: build/gpt2_webgpu
. $(GPUCPP)/source && ./build/gpt2_webgpu
run-native: build/gpt2_webgpu_aot
. $(GPUCPP)/source && ./build/gpt2_webgpu_aot

# server: build/train_gpt2.html build/test_gpt2.html build/gpt2_gpucpp.html
server: build/gpt2_webgpu.html
Expand Down
Loading