Skip to content

Commit

Permalink
feat: ✨ Add HalideTutorial03
Browse files Browse the repository at this point in the history
add halide official tutorial03 with my own code
  • Loading branch information
RookieTars committed Mar 6, 2022
1 parent 0da0d4f commit c558103
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions HalideTutorial03/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
{
"cmake.configureSettings": {
"CMAKE_TOOLCHAIN_FILE": "C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
}
20 changes: 20 additions & 0 deletions HalideTutorial03/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 1,20 @@
cmake_minimum_required(VERSION 3.21)

project(halide_tutorial03)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

find_package(Halide REQUIRED)

add_executable(
${PROJECT_NAME}
main.cpp
)

target_link_libraries(
${PROJECT_NAME}
PRIVATE
Halide::Halide
)
16 changes: 16 additions & 0 deletions HalideTutorial03/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 1,16 @@
#include "Halide.h"
#include <stdio.h>

using namespace Halide;

int main()
{
Func gradient("gradient");
Var x("x"), y("y");
Expr e = x y;
gradient(x, y) = e;
Buffer<int> output = gradient.realize({8, 8});
gradient.compile_to_lowered_stmt("gradient.html", {}, HTML);
printf("Success!\n");
return 0;
}

0 comments on commit c558103

Please sign in to comment.