Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ vcpkg_installed/
################################################################################
## IDE directories and metadata

.ccls-cache/

# Visual Studio
.vs/
out/
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ PERFORMANCE_TESTS = $(shell ls $(ROOT_DIR)/test/performance/*.cpp)
ERROR_TESTS = $(shell ls $(ROOT_DIR)/test/error/*.cpp)
WARNING_TESTS = $(shell ls $(ROOT_DIR)/test/warning/*.cpp)
RUNTIME_TESTS = $(shell ls $(ROOT_DIR)/test/runtime/*.cpp)
FUZZ_TESTS = $(filter-out %halide_fuzz_main.cpp, $(shell ls $(ROOT_DIR)/test/fuzz/*.cpp))
FUZZ_TESTS = $(filter-out %halide_fuzz_main.cpp %ExprInterpreter.cpp, $(shell ls $(ROOT_DIR)/test/fuzz/*.cpp))
GENERATOR_EXTERNAL_TESTS := $(shell ls $(ROOT_DIR)/test/generator/*test.cpp)
GENERATOR_EXTERNAL_TEST_GENERATOR := $(shell ls $(ROOT_DIR)/test/generator/*_generator.cpp)
TUTORIALS = $(filter-out %_generate.cpp, $(shell ls $(ROOT_DIR)/tutorial/*.cpp))
Expand Down Expand Up @@ -1475,7 +1475,7 @@ $(BIN_DIR)/$(TARGET)/correctness_opencl_runtime: $(ROOT_DIR)/test/correctness/op
$(BIN_DIR)/performance_%: $(ROOT_DIR)/test/performance/%.cpp $(TEST_DEPS)
$(CXX) $(TEST_CXX_FLAGS) $(OPTIMIZE) $< -I$(INCLUDE_DIR) -I$(ROOT_DIR)/src/runtime -I$(ROOT_DIR)/test/common $(TEST_LD_FLAGS) -o $@

$(BIN_DIR)/fuzz_%: $(ROOT_DIR)/test/fuzz/%.cpp $(ROOT_DIR)/test/fuzz/halide_fuzz_main.cpp $(ROOT_DIR)/test/fuzz/fuzz_helpers.h $(ROOT_DIR)/test/fuzz/halide_fuzz_main.h $(TEST_DEPS)
$(BIN_DIR)/fuzz_%: $(ROOT_DIR)/test/fuzz/%.cpp $(ROOT_DIR)/test/fuzz/halide_fuzz_main.cpp $(ROOT_DIR)/test/fuzz/fuzz_helpers.h $(ROOT_DIR)/test/fuzz/halide_fuzz_main.h $(ROOT_DIR)/test/fuzz/ExprInterpreter.cpp $(ROOT_DIR)/test/fuzz/ExprInterpreter.h $(TEST_DEPS)
$(CXX) $(TEST_CXX_FLAGS) -I$(ROOT_DIR)/src/runtime -I$(ROOT_DIR)/test/common $(OPTIMIZE_FOR_BUILD_TIME) $(filter %.cpp,$^) -I$(INCLUDE_DIR) $(TEST_LD_FLAGS) -o $@ -DHALIDE_FUZZER_BACKEND=0

# Error tests that link against libHalide
Expand Down
24 changes: 24 additions & 0 deletions src/IR.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,30 @@ struct Call : public ExprNode<Call> {
Call::strict_sub});
}

/** Does not include the strict_float intrinsics. */
bool is_arithmetic_intrinsic() const {
return is_intrinsic(
{Call::widen_right_add,
Call::widen_right_mul,
Call::widen_right_sub,
Call::widening_add,
Call::widening_mul,
Call::widening_sub,
Call::saturating_add,
Call::saturating_sub,
Call::saturating_cast,
Call::widening_shift_left,
Call::widening_shift_right,
Call::rounding_shift_right,
Call::rounding_shift_left,
Call::halving_add,
Call::halving_sub,
Call::rounding_halving_add,
Call::rounding_mul_shift_right,
Call::mul_shift_right,
Call::sorted_avg});
}

static const IRNodeType _node_type = IRNodeType::Call;
};

Expand Down
10 changes: 6 additions & 4 deletions test/fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, std::size_t Size) {
}
]] HAVE_LIBFUZZER_FLAGS)

add_library(Halide_fuzz INTERFACE)
add_library(Halide_fuzz OBJECT)
add_library(Halide::fuzz ALIAS Halide_fuzz)
target_sources(Halide_fuzz PRIVATE ExprInterpreter.cpp)
target_link_libraries(Halide_fuzz PRIVATE Halide::Halide Halide::Test)

if (NOT HAVE_LIBFUZZER_FLAGS)
if (LIB_FUZZING_ENGINE)
message(FATAL_ERROR "Cannot set LIB_FUZZING_ENGINE when not building with -fsanitize=fuzzer or a compatible fuzzing engine.")
endif ()
target_sources(Halide_fuzz INTERFACE halide_fuzz_main.cpp halide_fuzz_main.h)
target_compile_definitions(Halide_fuzz INTERFACE HALIDE_FUZZER_BACKEND=HALIDE_FUZZER_BACKEND_STDLIB)
target_sources(Halide_fuzz PRIVATE halide_fuzz_main.cpp halide_fuzz_main.h)
target_compile_definitions(Halide_fuzz PUBLIC HALIDE_FUZZER_BACKEND=HALIDE_FUZZER_BACKEND_STDLIB)
else ()
target_link_libraries(Halide_fuzz INTERFACE ${LIB_FUZZING_ENGINE})
target_compile_definitions(Halide_fuzz INTERFACE HALIDE_FUZZER_BACKEND=HALIDE_FUZZER_BACKEND_LIBFUZZER)
target_compile_definitions(Halide_fuzz PUBLIC HALIDE_FUZZER_BACKEND=HALIDE_FUZZER_BACKEND_LIBFUZZER)
endif ()

foreach (fuzzer IN LISTS TEST_NAMES)
Expand Down
Loading
Loading