Skip to content

Commit 223e2c5

Browse files
committed
DRAFT initial circle-mlir project
on-going draft to introduce initial circle-mlir project. Signed-off-by: SaeHie Park <[email protected]>
1 parent 1125136 commit 223e2c5

36 files changed

+4735
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Run Circle-MLIR Ubuntu Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- release/*
8+
paths:
9+
- '.github/workflows/run-circle-mlir-build.yml'
10+
- 'circle-mlir/**'
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
# Cancel previous running jobs when pull request is updated
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
circle-mlir-test:
23+
if: github.repository_owner == 'Samsung'
24+
strategy:
25+
matrix:
26+
type: [ Debug, Release ]
27+
ubuntu_code: [ jammy ]
28+
include:
29+
- ubuntu_code: jammy
30+
ubuntu_vstr: u2204
31+
32+
runs-on: ubuntu-${{ matrix.ubuntu_ver }}
33+
34+
container:
35+
image: nnfw/circle-mlir-build-${{ matrix.ubuntu_vstr }}:latest
36+
options: --user root
37+
38+
name: circle-mlir ${{ matrix.ubuntu_vstr }} ${{ matrix.type }} test
39+
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
# TODO download circle-interpreter
45+
46+
# NOTE Docker image has pre-installed submodules in /workdir
47+
# NOTE Docker image has pre-installed python packages
48+
- name: Configure
49+
run: |
50+
Python3_ROOT_DIR=/usr/bin cmake -B build/${{ matrix.type }} -S ./circle-mlir \
51+
-DCMAKE_INSTALL_PREFIX=build/${{ matrix.type }}.install \
52+
-DCMAKE_BUILD_TYPE=${{ matrix.type }} \
53+
-DCIRCLE_MLIR_WORKDIR=/workdir
54+
55+
- name: Build, test & install
56+
run: |
57+
cmake --build build/${{ matrix.type }} -j4
58+
CTEST_OUTPUT_ON_FAILURE=1 cmake --build build/${{ matrix.type }} --verbose -- test
59+
cmake --build build/${{ matrix.type }} -j4 -- install

circle-mlir/CMakeLists.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Match the minimum required version of LLVM and MLIR
2+
cmake_minimum_required(VERSION 3.13.4)
3+
4+
project(circle-mlir)
5+
6+
set(CMAKE_CXX_STANDARD 17)
7+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
9+
if(NOT CMAKE_BUILD_TYPE)
10+
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Type of build" FORCE)
11+
endif(NOT CMAKE_BUILD_TYPE)
12+
13+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
14+
add_compile_options("-fexceptions")
15+
16+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/infra/cmake")
17+
18+
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
19+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
20+
cmake_policy(SET CMP0135 NEW)
21+
endif()
22+
23+
# configuration flags
24+
include(CfgOptionFlags)
25+
26+
# enable test coverage
27+
include(TestCoverage)
28+
29+
# enable ctest
30+
include(CTest)
31+
32+
# enable googletest
33+
include(GTestHelper)
34+
include(GoogleTest)
35+
36+
# to override submodules install
37+
if(DEFINED ENV{CIRCLE_MLIR_LOCALINST})
38+
set(CIRCLE_MLIR_LOCALINST $ENV{CIRCLE_MLIR_LOCALINST})
39+
endif()
40+
41+
if(CIRCLE_MLIR_LOCALINST)
42+
message(STATUS "CIRCLE_MLIR_LOCALINST=${CIRCLE_MLIR_LOCALINST}")
43+
endif()
44+
45+
add_subdirectory(circle-mlir)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include(UseMLIR)
2+
include(UseAbseil)
3+
4+
add_subdirectory(lib)
5+
add_subdirectory(tools)
6+
add_subdirectory(tools-test)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
add_subdirectory(tools)
2+
3+
add_subdirectory(arser)
4+
add_subdirectory(schema)
5+
#add_subdirectory(dialect)
6+
add_subdirectory(utils)
7+
#add_subdirectory(pass)
8+
#add_subdirectory(import)
9+
#add_subdirectory(export)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
add_library(arser INTERFACE)
2+
3+
# It specifies INTERFACE so that future targets linked with arser library will inherit its include directory.
4+
# It means that a developer who want to link arser just need to add one line.
5+
# target_link_library(another-users-target arser)
6+
target_include_directories(arser INTERFACE include/)
7+
8+
# NOTE test for arser are removed.
9+
# instead, add arser_validate to validate header compilation.
10+
add_library(arser_validate STATIC src/arser.cpp)
11+
target_link_libraries(arser_validate PUBLIC arser)
12+
13+
if(NOT ENABLE_TEST)
14+
return()
15+
endif()
16+
17+
GTest_AddTest(arser_test test/arser.test.cpp)
18+
target_link_libraries(arser_test arser)
19+
target_link_libraries(arser_test cirmlir_coverage)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# arser
2+
3+
From https://github.com/Samsung/ONE/tree/d808a9973093bf8062a253d5c8f66072d7100551/compiler/arser

0 commit comments

Comments
 (0)