Skip to content

Commit

Permalink
#3058: WIP PLS REDO
Browse files Browse the repository at this point in the history
  • Loading branch information
tt-rkim committed Feb 26, 2024
1 parent aa65e6d commit af82db9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/tt_eager/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TT_EAGER_TESTS += \
TT_EAGER_TESTS_SRCS = $(addprefix tests/tt_eager/, $(addsuffix .cpp, $(TT_EAGER_TESTS:tests/%=%)))

TT_EAGER_TESTS_INCLUDES = $(TEST_INCLUDES) $(TT_EAGER_INCLUDES)
TT_EAGER_TESTS_LDFLAGS = $(TT_METAL_TESTS_LDFLAGS) $(TT_LIB_LDFLAGS)
TT_EAGER_TESTS_LDFLAGS = $(TT_METAL_TESTS_LDFLAGS) $(TT_LIB_LDFLAGS) -ltt_eager

TT_EAGER_TESTS_OBJS = $(addprefix $(OBJDIR)/, $(TT_EAGER_TESTS_SRCS:.cpp=.o))
TT_EAGER_TESTS_DEPS = $(addprefix $(OBJDIR)/, $(TT_EAGER_TESTS_SRCS:.cpp=.d))
Expand Down
7 changes: 1 addition & 6 deletions tt_eager/dtx/module.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Every variable in subdir must be prefixed with subdir (emulating a namespace)
DTX_LIB = $(LIBDIR)/libdtx.a
DTX_DEFINES =
DTX_INCLUDES = $(TT_EAGER_INCLUDES)
DTX_CFLAGS = $(CFLAGS) -Werror -Wno-int-to-pointer-cast
Expand Down Expand Up @@ -34,11 +33,7 @@ DTX_DEPS = $(addprefix $(OBJDIR)/, $(DTX_SRCS:.cpp=.d))
-include $(DTX_DEPS)

# Each module has a top level target as the entrypoint which must match the subdir name
tt_eager/dtx: $(DTX_LIB)

$(DTX_LIB): $(COMMON_LIB) $(TT_METAL_LIB) $(TENSOR_LIB) $(DTX_OBJS)
@mkdir -p $(@D)
ar rcs -o $@ $(DTX_OBJS)
tt_eager/dtx: $(DTX_OBJS) $(TENSOR_OBJS)

$(OBJDIR)/tt_eager/dtx/%.o: tt_eager/dtx/%.cpp
@mkdir -p $(@D)
Expand Down
7 changes: 1 addition & 6 deletions tt_eager/tt_dnn/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ TT_DNN_SRCS = \
tt_eager/tt_dnn/op_library/upsample/upsample_op.cpp \


TT_DNN_LIB = $(LIBDIR)/libtt_dnn.a
TT_DNN_DEFINES =
TT_DNN_INCLUDES = $(TT_EAGER_INCLUDES)
TT_DNN_CFLAGS = $(CFLAGS) -Werror -Wno-int-to-pointer-cast
Expand All @@ -184,11 +183,7 @@ TT_DNN_DEPS = $(addprefix $(OBJDIR)/, $(TT_DNN_SRCS:.cpp=.d))
-include $(TT_DNN_DEPS)

# Each module has a top level target as the entrypoint which must match the subdir name
tt_eager/tt_dnn: $(TT_DNN_LIB)

$(TT_DNN_LIB): $(COMMON_LIB) $(DTX_LIB) $(TT_DNN_OBJS)
@mkdir -p $(LIBDIR)
ar rcs -o $@ $(TT_DNN_OBJS)
tt_eager/tt_dnn: $(TT_DNN_OBJS) $(DTX_OBJS)

$(OBJDIR)/tt_eager/tt_dnn/%.o: tt_eager/tt_dnn/%.cpp
@mkdir -p $(@D)
Expand Down
8 changes: 5 additions & 3 deletions tt_eager/tt_lib/csrc/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TT_LIB_LIB = $(LIBDIR)/libtt_lib_csrc.so
TT_LIB_LIB_LOCAL_SO = tt_eager/tt_lib/_C.so
TT_LIB_DEFINES =
TT_LIB_INCLUDES = $(TT_EAGER_INCLUDES) $(shell python3-config --includes) -Itt_metal/third_party/pybind11/include
TT_LIB_LDFLAGS = -ltt_dnn -ldtx -ltensor -lqueue -ltt_metal -lyaml-cpp $(LDFLAGS)
TT_LIB_LDFLAGS = -ltensor -ltt_metal -lyaml-cpp $(LDFLAGS)
TT_LIB_CFLAGS = $(CFLAGS) -Werror -Wno-int-to-pointer-cast -fno-var-tracking

TT_LIB_SRCS = \
Expand All @@ -23,10 +23,12 @@ TT_LIB_DEPS = $(addprefix $(OBJDIR)/, $(TT_LIB_SRCS:.cpp=.d))

tt_lib: $(TT_LIB_LIB)

TT_LIB_DEP_OBJS = $(TT_LIB_OBJS) $(TT_DNN_OBJS) $(DTX_OBJS) $(QUEUE_OBJS)

# Link obj files into shared lib
$(TT_LIB_LIB): $(TT_LIB_OBJS) $(TT_DNN_LIB) $(TENSOR_LIB) $(DTX_LIB) $(TT_METAL_LIB)
$(TT_LIB_LIB): $(TT_LIB_DEP_OBJS) $(TENSOR_LIB) $(TT_METAL_LIB)
@mkdir -p $(LIBDIR)
$(CXX) $(TT_LIB_CFLAGS) $(CXXFLAGS) $(SHARED_LIB_FLAGS) -o $@ $(TT_LIB_OBJS) $(TT_LIB_LDFLAGS)
$(CXX) $(TT_LIB_CFLAGS) $(CXXFLAGS) $(SHARED_LIB_FLAGS) -o $@ $(TT_LIB_DEP_OBJS) $(TT_LIB_LDFLAGS)

$(TT_LIB_LIB_LOCAL_SO): $(TT_LIB_LIB)
cp -fp $^ $@
Expand Down

0 comments on commit af82db9

Please sign in to comment.