Skip to content

Commit

Permalink
Merge pull request #2 from halide/master
Browse files Browse the repository at this point in the history
Merge from mainline
  • Loading branch information
kgnk committed May 18, 2016
2 parents 8424a29 + 5dc15c4 commit 1f7f8c4
Show file tree
Hide file tree
Showing 54 changed files with 2,136 additions and 754 deletions.
23 changes: 9 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ SOURCE_FILES = \
AddImageChecks.cpp \
AddParameterChecks.cpp \
AllocationBoundsInference.cpp \
BlockFlattening.cpp \
BoundaryConditions.cpp \
Bounds.cpp \
BoundsInference.cpp \
Expand Down Expand Up @@ -293,6 +292,7 @@ SOURCE_FILES = \
FuseGPUThreadLoops.cpp \
Generator.cpp \
Image.cpp \
ImageParam.cpp \
InjectHostDevBufferCopies.cpp \
InjectImageIntrinsics.cpp \
InjectOpenGLIntrinsics.cpp \
Expand All @@ -318,8 +318,8 @@ SOURCE_FILES = \
ModulusRemainder.cpp \
Monotonic.cpp \
ObjectInstanceRegistry.cpp \
OutputImageParam.cpp \
ParallelRVar.cpp \
Param.cpp \
Parameter.cpp \
PartitionLoops.cpp \
Pipeline.cpp \
Expand All @@ -340,6 +340,7 @@ SOURCE_FILES = \
SkipStages.cpp \
SlidingWindow.cpp \
Solve.cpp \
StaticLibrary.cpp \
StmtToHtml.cpp \
StorageFlattening.cpp \
StorageFolding.cpp \
Expand Down Expand Up @@ -375,7 +376,6 @@ HEADER_FILES = \
AddParameterChecks.h \
AllocationBoundsInference.h \
Argument.h \
BlockFlattening.h \
BoundaryConditions.h \
Bounds.h \
BoundsInference.h \
Expand Down Expand Up @@ -419,6 +419,7 @@ HEADER_FILES = \
Generator.h \
runtime/HalideRuntime.h \
Image.h \
ImageParam.h \
InjectHostDevBufferCopies.h \
InjectImageIntrinsics.h \
InjectOpenGLIntrinsics.h \
Expand Down Expand Up @@ -448,6 +449,7 @@ HEADER_FILES = \
Monotonic.h \
ObjectInstanceRegistry.h \
Outputs.h \
OutputImageParam.h \
ParallelRVar.h \
Parameter.h \
Param.h \
Expand All @@ -470,6 +472,7 @@ HEADER_FILES = \
SkipStages.h \
SlidingWindow.h \
Solve.h \
StaticLibrary.h \
StmtToHtml.h \
StorageFlattening.h \
StorageFolding.h \
Expand Down Expand Up @@ -743,7 +746,7 @@ test_generators: \
ALL_TESTS = test_internal test_correctness test_errors test_tutorials test_warnings test_generators test_renderscript

# These targets perform timings of each test. For most tests this includes Halide JIT compile times, and run times.
# For static and generator tests they time the compile time only. The times are recorded in CSV files.
# For generator tests they time the compile time only. The times are recorded in CSV files.
time_compilation_correctness: init_time_compilation_correctness $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=time_compilation_test_%)
time_compilation_performance: init_time_compilation_performance $(PERFORMANCE_TESTS:$(ROOT_DIR)/test/performance/%.cpp=time_compilation_performance_%)
time_compilation_opengl: init_time_compilation_opengl $(OPENGL_TESTS:$(ROOT_DIR)/test/opengl/%.cpp=time_compilation_opengl_%)
Expand All @@ -767,7 +770,7 @@ build_tests: $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=$(BIN_DIR)/c
$(GENERATOR_EXTERNAL_TESTS:$(ROOT_DIR)/test/generator/%_jittest.cpp=$(BIN_DIR)/generator_jit_%) \
$(RENDERSCRIPT_TESTS:$(ROOT_DIR)/test/renderscript/%.cpp=$(BIN_DIR)/renderscript_%)

time_compilation_tests: time_compilation_correctness time_compilation_performance time_compilation_static time_compilation_generators
time_compilation_tests: time_compilation_correctness time_compilation_performance time_compilation_generators

# Make an empty generator for generating runtimes.
$(BIN_DIR)/runtime.generator: $(ROOT_DIR)/tools/GenGen.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT)
Expand All @@ -776,7 +779,7 @@ $(BIN_DIR)/runtime.generator: $(ROOT_DIR)/tools/GenGen.cpp $(BIN_DIR)/libHalide.
# Generate a standalone runtime for a given target string
$(RUNTIMES_DIR)/runtime_%.o: $(BIN_DIR)/runtime.generator
@mkdir -p $(RUNTIMES_DIR)
$(LD_PATH_SETUP) $(CURDIR)/$< -r $(notdir $@) -o $(CURDIR)/$(RUNTIMES_DIR) target=$*
$(LD_PATH_SETUP) $(CURDIR)/$< -r $(basename $(notdir $@)) -o $(CURDIR)/$(RUNTIMES_DIR) target=$*

$(BIN_DIR)/test_internal: $(ROOT_DIR)/test/internal.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT)
$(CXX) $(CXX_FLAGS) $< -I$(SRC_DIR) -L$(BIN_DIR) -lHalide $(TEST_LDFLAGS) -lpthread $(LIBDL) -lz -o $@
Expand All @@ -801,11 +804,6 @@ $(BIN_DIR)/opengl_%: $(ROOT_DIR)/test/opengl/%.cpp $(BIN_DIR)/libHalide.$(SHARED
$(BIN_DIR)/renderscript_%: $(ROOT_DIR)/test/renderscript/%.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(INCLUDE_DIR)/Halide.h
$(CXX) $(TEST_CXX_FLAGS) $(OPTIMIZE) $< -I$(INCLUDE_DIR) -I$(SRC_DIR) -L$(BIN_DIR) -lHalide $(TEST_LDFLAGS) -lpthread $(LIBDL) -lz -o $@

$(TMP_DIR)/static/%/%.o: $(BIN_DIR)/static_%_generate
@-mkdir -p $(TMP_DIR)/static/$*
cd $(TMP_DIR)/static/$*; $(LD_PATH_SETUP) $(CURDIR)/$<
@-echo

# TODO(srj): this doesn't auto-delete, why not?
.INTERMEDIATE: $(FILTERS_DIR)/%.generator

Expand Down Expand Up @@ -1041,9 +1039,6 @@ time_compilation_opengl_%: $(BIN_DIR)/opengl_%
time_compilation_renderscript_%: $(BIN_DIR)/renderscript_%
$(TIME_COMPILATION) compile_times_renderscript.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_renderscript_%=renderscript_%)

time_compilation_static_%: $(BIN_DIR)/static_%_generate
$(TIME_COMPILATION) compile_times_static.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_static_%=$(TMP_DIR)/static/%/%.o)

time_compilation_generator_%: $(FILTERS_DIR)/%.generator
$(TIME_COMPILATION) compile_times_generator.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_generator_%=$(FILTERS_DIR)/%.o)

Expand Down
13 changes: 3 additions & 10 deletions apps/glsl/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
include ../support/Makefile.inc

TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
.PHONY: all $(TOP)
all:
HALIDE_LIB := $(TOP)/$(LIB_HALIDE)
$(HALIDE_LIB): $(TOP)
$(MAKE) -C $(TOP) $(LIB_HALIDE)

CXXFLAGS += -g -O0

UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
OPENGL_LIBS = -lX11 -lGL
endif

HALIDE_LIBS = $(HALIDE_LIB) -ldl $(LLVM_LDFLAGS)
HALIDE_LIBS = $(LIB_HALIDE) -ldl $(LLVM_LDFLAGS)

all: opengl_test

Expand All @@ -25,10 +18,10 @@ opengl_test: blur.o ycc.o opengl_test.o
$(CXX) $(CXXFLAGS) $^ -o $@ -ldl -lpthread -L$(TOP)/bin $(OPENGL_LIBS)

blur.h blur.o: halide_blur
HL_TARGET=host-opengl-gpu_debug ./halide_blur
HL_TARGET=host-opengl-debug ./halide_blur

ycc.h ycc.o: halide_ycc
HL_TARGET=host-opengl-gpu_debug ./halide_ycc
HL_TARGET=host-opengl-debug ./halide_ycc

halide_blur: halide_blur.o $(HALIDE_LIB)
$(CXX) $(CXXFLAGS) $< -o $@ $(CXXFLAGS) $(HALIDE_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion apps/wavelet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $(BUILD_DIR)/%.o $(BUILD_DIR)/%.h: $(BUILD_DIR)/%.generator
$(BUILD_DIR)/runtime_$(HL_TARGET).o: $(BUILD_DIR)/haar_x.generator
@echo Compiling Halide runtime for target $(HL_TARGET)
@mkdir -p $(BUILD_DIR)
@$< -r runtime_$(HL_TARGET).o -o $(BUILD_DIR) target=$(HL_TARGET)
@$< -r runtime_$(HL_TARGET) -o $(BUILD_DIR) target=$(HL_TARGET)

HL_MODULES = \
$(BUILD_DIR)/daubechies_x.o \
Expand Down
3 changes: 2 additions & 1 deletion python_bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ endif()

file(GLOB SrcCpp
python/*.cpp
../src/Param.cpp)
../src/OutputImageParam.cpp
../src/ImageParam.cpp)

add_library(halide SHARED ${SrcCpp})
target_link_libraries(halide
Expand Down
4 changes: 2 additions & 2 deletions python_bindings/python/BoundaryConditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <boost/python.hpp>

#include "../../src/Lambda.h" // needed by BoundaryConditions.h
#include "../../src/ImageParam.h"
#include "../../src/BoundaryConditions.h"
#include "../../src/Func.h"

Expand Down Expand Up @@ -142,7 +143,7 @@ void def_mirror_interior_for_image<void>()

void defineBoundaryConditions()
{


// Other variants of constant_exterior exist, but not yet implemented

Expand Down Expand Up @@ -244,4 +245,3 @@ void defineBoundaryConditions()

return;
}

3 changes: 2 additions & 1 deletion python_bindings/python/Param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "add_operators.h"

#include "../../src/Param.h"
#include "../../src/OutputImageParam.h"
#include "../../src/ImageParam.h"
#include "../../src/IROperator.h" // enables Param + Expr operations (which include is it ?)
#include "Type.h"

Expand Down Expand Up @@ -124,7 +126,6 @@ void defineImageParam()
;

p::implicitly_convertible<ImageParam, h::Argument>();
p::implicitly_convertible<ImageParam, h::Expr>();

// "Using a param as the argument to an external stage treats it as an Expr"
//p::implicitly_convertible<ImageParam, h::ExternFuncArgument>();
Expand Down
1 change: 1 addition & 0 deletions python_bindings/python/RDom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "add_operators.h"

#include "../../src/RDom.h"
#include "../../src/ImageParam.h"
#include "../../src/IROperator.h" // for operations with RVar

#include <string>
Expand Down
48 changes: 0 additions & 48 deletions src/BlockFlattening.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions src/BlockFlattening.h

This file was deleted.

9 changes: 6 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ set(HEADER_FILES
AddParameterChecks.h
AllocationBoundsInference.h
Argument.h
BlockFlattening.h
BoundaryConditions.h
Bounds.h
BoundsInference.h
Expand Down Expand Up @@ -252,6 +251,7 @@ set(HEADER_FILES
IRPrinter.h
IRVisitor.h
Image.h
ImageParam.h
InjectHostDevBufferCopies.h
InjectImageIntrinsics.h
InjectOpenGLIntrinsics.h
Expand All @@ -273,6 +273,7 @@ set(HEADER_FILES
ModulusRemainder.h
Monotonic.h
ObjectInstanceRegistry.h
OutputImageParam.h
Outputs.h
ParallelRVar.h
Param.h
Expand All @@ -296,6 +297,7 @@ set(HEADER_FILES
SkipStages.h
SlidingWindow.h
Solve.h
StaticLibrary.h
StmtToHtml.h
StorageFlattening.h
StorageFolding.h
Expand Down Expand Up @@ -350,7 +352,6 @@ add_library(Halide ${HALIDE_LIBRARY_TYPE}
AddImageChecks.cpp
AddParameterChecks.cpp
AllocationBoundsInference.cpp
BlockFlattening.cpp
BoundaryConditions.cpp
Bounds.cpp
BoundsInference.cpp
Expand Down Expand Up @@ -399,6 +400,7 @@ add_library(Halide ${HALIDE_LIBRARY_TYPE}
IRPrinter.cpp
IRVisitor.cpp
Image.cpp
ImageParam.cpp
InjectHostDevBufferCopies.cpp
InjectImageIntrinsics.cpp
InjectOpenGLIntrinsics.cpp
Expand All @@ -417,8 +419,8 @@ add_library(Halide ${HALIDE_LIBRARY_TYPE}
ModulusRemainder.cpp
Monotonic.cpp
ObjectInstanceRegistry.cpp
OutputImageParam.cpp
ParallelRVar.cpp
Param.cpp
Parameter.cpp
PartitionLoops.cpp
Pipeline.cpp
Expand All @@ -439,6 +441,7 @@ add_library(Halide ${HALIDE_LIBRARY_TYPE}
SkipStages.cpp
SlidingWindow.cpp
Solve.cpp
StaticLibrary.cpp
StmtToHtml.cpp
StorageFlattening.cpp
StorageFolding.cpp
Expand Down
14 changes: 7 additions & 7 deletions src/CodeGen_Internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ void clone_target_options(const llvm::Module &from, llvm::Module &to) {
}
}

llvm::TargetMachine *get_target_machine(const llvm::Module &module) {
std::unique_ptr<llvm::TargetMachine> make_target_machine(const llvm::Module &module) {
std::string error_string;

const llvm::Target *target = llvm::TargetRegistry::lookupTarget(module.getTargetTriple(), error_string);
Expand All @@ -369,12 +369,12 @@ llvm::TargetMachine *get_target_machine(const llvm::Module &module) {
std::string mattrs = "";
get_target_options(module, options, mcpu, mattrs);

return target->createTargetMachine(module.getTargetTriple(),
mcpu, mattrs,
options,
llvm::Reloc::PIC_,
llvm::CodeModel::Default,
llvm::CodeGenOpt::Aggressive);
return std::unique_ptr<llvm::TargetMachine>(target->createTargetMachine(module.getTargetTriple(),
mcpu, mattrs,
options,
llvm::Reloc::PIC_,
llvm::CodeModel::Default,
llvm::CodeGenOpt::Aggressive));
}

}
Expand Down
4 changes: 3 additions & 1 deletion src/CodeGen_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* front-end-facing interface to CodeGen).
*/

#include <memory>

#include "IR.h"
#include "IRVisitor.h"
#include "LLVM_Headers.h"
Expand Down Expand Up @@ -62,7 +64,7 @@ void get_target_options(const llvm::Module &module, llvm::TargetOptions &options
void clone_target_options(const llvm::Module &from, llvm::Module &to);

/** Given an llvm::Module, get or create an llvm:TargetMachine */
llvm::TargetMachine *get_target_machine(const llvm::Module &module);
std::unique_ptr<llvm::TargetMachine> make_target_machine(const llvm::Module &module);

}}

Expand Down
Loading

0 comments on commit 1f7f8c4

Please sign in to comment.