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 support to the makefile for serialization #7762

Merged
merged 4 commits into from
Aug 24, 2023
Merged
Changes from all 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
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ CXX_FLAGS += $(SPIRV_CXX_FLAGS)
CXX_FLAGS += $(VULKAN_CXX_FLAGS)
CXX_FLAGS += $(WEBASSEMBLY_CXX_FLAGS)

# Serialization requires flatc and flatbuffers.h
# On ubuntu, this requires packages flatbuffers-compiler and libflatbuffers-dev
ifneq (,$(shell which flatc))
CXX_FLAGS += -DWITH_SERIALIZATION -I $(BUILD_DIR) -I $(shell which flatc | sed 's/bin.flatc/include/')
endif

# This is required on some hosts like powerpc64le-linux-gnu because we may build
# everything with -fno-exceptions. Without -funwind-tables, libHalide.so fails
# to propagate exceptions and causes a test failure.
Expand Down Expand Up @@ -499,6 +505,7 @@ SOURCE_FILES = \
Deinterleave.cpp \
Derivative.cpp \
DerivativeUtils.cpp \
Deserialization.cpp \
DeviceArgument.cpp \
DeviceInterface.cpp \
Dimension.cpp \
Expand Down Expand Up @@ -577,6 +584,7 @@ SOURCE_FILES = \
Schedule.cpp \
ScheduleFunctions.cpp \
SelectGPUAPI.cpp \
Serialization.cpp \
Simplify.cpp \
Simplify_Add.cpp \
Simplify_And.cpp \
Expand Down Expand Up @@ -687,6 +695,7 @@ HEADER_FILES = \
Deinterleave.h \
Derivative.h \
DerivativeUtils.h \
Deserialization.h \
DeviceAPI.h \
DeviceArgument.h \
DeviceInterface.h \
Expand Down Expand Up @@ -776,6 +785,7 @@ HEADER_FILES = \
ScheduleFunctions.h \
Scope.h \
SelectGPUAPI.h \
Serialization.h \
Simplify.h \
SimplifyCorrelatedDifferences.h \
SimplifySpecializations.h \
Expand Down Expand Up @@ -1382,6 +1392,16 @@ $(BIN_DIR)/test_internal: $(ROOT_DIR)/test/internal.cpp $(BIN_DIR)/libHalide.$(S
@mkdir -p $(@D)
$(CXX) $(TEST_CXX_FLAGS) $< -I$(SRC_DIR) $(TEST_LD_FLAGS) -o $@

ifneq (,$(shell which flatc))
$(BUILD_DIR)/Deserialization.o : $(BUILD_DIR)/halide_ir_generated.h
$(BUILD_DIR)/Serialization.o : $(BUILD_DIR)/halide_ir_generated.h
endif

# Generated header for serialization/deserialization
$(BUILD_DIR)/halide_ir_generated.h: $(SRC_DIR)/halide_ir.fbs
@mkdir -p $(@D)
flatc -o $(BUILD_DIR) -c $^

# Correctness test that link against libHalide
$(BIN_DIR)/correctness_%: $(ROOT_DIR)/test/correctness/%.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(INCLUDE_DIR)/Halide.h $(RUNTIME_EXPORTED_INCLUDES)
@mkdir -p $(@D)
Expand Down