Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

MLIR based backend for Numba #115

Draft
wants to merge 278 commits into
base: mlir-develop-base
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
278 commits
Select commit Hold shift + click to select a range
33f720e
some refac
Oct 5, 2020
73125ac
remove old lowering
Oct 5, 2020
7c35319
change structure
Oct 5, 2020
3780e11
some refac
Oct 5, 2020
450b8f3
refac
Oct 5, 2020
af98ac8
update tests
Oct 5, 2020
6981432
basic compiler infrastructure
Oct 5, 2020
7fd5f80
cast folding
Oct 5, 2020
8905592
refac
Oct 5, 2020
ac64f46
refac
Oct 5, 2020
be9babc
pass stub
Oct 5, 2020
8ca1f7c
update to latest mlir
Oct 5, 2020
4ed069a
refac
Oct 5, 2020
0429bd3
func args
Oct 5, 2020
8588e7e
func args folding
Oct 5, 2020
d0a5f4c
some rewrites
Oct 5, 2020
185a5fa
refac
Oct 7, 2020
95440cd
work on lowerer to llvm
Oct 8, 2020
aa10a12
work on llvm lowering
Oct 8, 2020
d7f9d70
work on llvm lowering
Oct 8, 2020
b21bd13
fix
Oct 8, 2020
d2cb767
gen llvm module
Oct 8, 2020
95e2032
execute code from mlir
Oct 8, 2020
cc2c92f
remove unused
Oct 8, 2020
a1eb710
refac
Oct 9, 2020
89ab768
bool cast lowering
Oct 9, 2020
9eb9955
convert block args types
Oct 9, 2020
eeef3a5
refac
Oct 9, 2020
0e85e18
tests
Oct 10, 2020
ca5d7f3
refac
Oct 10, 2020
2f22ee2
ops tests
Oct 10, 2020
ce72419
cmp ops
Oct 10, 2020
c256448
const ops tests
Oct 10, 2020
7e07104
more tests
Oct 10, 2020
8196a10
some error handling
Oct 10, 2020
6221c08
more checks
Oct 10, 2020
3c48f83
read settings from python
Oct 10, 2020
3f3be01
more checks
Oct 10, 2020
08043cf
some float support
Oct 10, 2020
c703465
float handling
Oct 11, 2020
4253134
refac
Oct 11, 2020
7b4d424
pass registry stub
Oct 11, 2020
bf46a77
refac
Oct 11, 2020
9dbaef9
work on pipeline deps
Oct 11, 2020
a644880
check for graph cycles
Oct 11, 2020
7490713
refac
Oct 11, 2020
d4cd617
fix
Oct 12, 2020
a20dafc
refac
Oct 12, 2020
ab798bd
refac
Oct 12, 2020
02350c3
some refac
Oct 14, 2020
a2c88ac
pair
Oct 14, 2020
f63ebee
translate tuples to multiple results
Oct 14, 2020
94d307d
pair ops folding
Oct 14, 2020
1f71e94
tuples
Oct 14, 2020
aad613b
fix
Oct 15, 2020
c3fb6aa
refac
Oct 15, 2020
3314620
refac
Oct 15, 2020
53cfca1
plier to linalg pipeline stub
Oct 16, 2020
3b19516
more stubs
Oct 16, 2020
60ec6c7
move files
Oct 16, 2020
cd6d3dd
refac func sig conversion
Oct 16, 2020
1ceee94
move FuncOpSignatureConversion to separate file
Oct 16, 2020
6bf8d4c
remove unused
Oct 16, 2020
d6f3049
refac
Oct 16, 2020
699d470
rename files
Oct 16, 2020
1f4cb02
move OpTypeConversion
Oct 16, 2020
61b95e5
print module on error
Oct 16, 2020
48beca4
remove hacky tuples folding
Oct 18, 2020
bea6ffb
refac
Oct 18, 2020
b3c1a62
some work
Oct 18, 2020
a130bc5
cleanup
Oct 18, 2020
c3119e4
refac binop
Oct 18, 2020
e69920d
some work
Oct 18, 2020
73fb697
refac
Oct 18, 2020
767d468
call op
Oct 18, 2020
ea264e7
conversion
Oct 18, 2020
715529e
update
Oct 18, 2020
beddb51
Merge branch 'plier-refac-conversion' into mlir-lowerer-plier-rebased
Oct 18, 2020
f21faeb
mlir dialect conversion is garbage
Oct 19, 2020
0af9f76
plier getattr
Oct 21, 2020
769f34a
some cleanup
Oct 21, 2020
ee97e1b
some type conversion
Oct 21, 2020
ac435fe
fix to conversion
Oct 21, 2020
af76faa
call op lowering
Oct 22, 2020
6c0f4b7
some work on linalg translation
Oct 23, 2020
2eb7a0c
some work on linalg
Oct 23, 2020
7329c03
simplify
Oct 23, 2020
5f974ca
reduction
Oct 23, 2020
07c437a
flag
Oct 26, 2020
d802f2e
Merge pull request #1 from IntelPython/mlir-lowerer-plier-rebased
Oct 26, 2020
2ab03e1
some work on array param translation
Oct 27, 2020
cd82f88
to llvm pass
Oct 28, 2020
833d247
lower temp casts, add test
Oct 28, 2020
b916be2
Merge pull request #2 from IntelPython/mlir-lowerer-plier-rebased
Oct 28, 2020
1e2dfaf
refactor CallOpLowering
Oct 28, 2020
dc317a2
move call lowering to separate file
Oct 28, 2020
058461d
refactor std call lowering
Oct 28, 2020
e07ac56
fix
Oct 29, 2020
10854ed
refac
Oct 29, 2020
c69dcb9
numpy add
Oct 29, 2020
a25d624
somme work
Oct 29, 2020
a90b9c2
plier getitem
Oct 29, 2020
d6faf60
simple getitem
Oct 29, 2020
3ef8fe0
fix
Oct 29, 2020
cd976fd
numpy static getitem
Oct 29, 2020
f1c549e
fix
Oct 29, 2020
ccfc055
fix uninitialized val
Oct 29, 2020
a264eb4
Merge pull request #3 from IntelPython/mlir-lowerer-plier-rebased
Nov 3, 2020
7e77b82
refactor cast
Nov 4, 2020
644bafb
move cast lowering to separate file
Nov 4, 2020
d2484d2
fix
Nov 4, 2020
df87b44
some work
Nov 4, 2020
d09b17f
move to mlir master
Nov 5, 2020
16702b9
Merge pull request #4 from IntelPython/mlir-lowerer-plier-rebased
Nov 5, 2020
3a0f09b
operate linalg on tensors
Nov 5, 2020
a4ee0ec
getitem lowering with tensors
Nov 5, 2020
540e281
update llvm
Nov 5, 2020
7f4ad2e
move createLowerToCFGPass to low lowering
Nov 5, 2020
285067a
fusing pass
Nov 6, 2020
399d337
some optimization passes
Nov 6, 2020
d322574
test
Nov 6, 2020
ac68884
asd
Nov 6, 2020
468d1bf
Merge pull request #5 from IntelPython/mlir-lowerer-plier-rebased
Nov 6, 2020
46a335c
fix type conversion
Nov 6, 2020
4090e9f
work on loop lowering
Nov 6, 2020
f009f46
range lowering
Nov 6, 2020
25979c9
fix for nested range
Nov 6, 2020
6a1ea49
update tests sandbox
Nov 6, 2020
421d5a9
fix
Nov 6, 2020
ed83588
Merge pull request #6 from IntelPython/mlir-lowerer-plier-rebased
Nov 7, 2020
d8db043
cfg to scf::if
Nov 6, 2020
3a212f5
update llvm
Nov 6, 2020
920b5f9
is_blocks_different
Nov 6, 2020
ad4df26
Merge pull request #7 from IntelPython/mlir-lowerer-plier-rebased
Nov 7, 2020
86807ca
transform loops to scf.while
Nov 6, 2020
34ce7ab
lower scf.for from scf.while
Nov 6, 2020
adc0b32
remove some unsued code
Nov 6, 2020
c76c545
Merge pull request #8 from IntelPython/mlir-lowerer-plier-rebased
Nov 8, 2020
2c9759c
refactor for loop lowering
Nov 6, 2020
948a716
move loop utils to separate file
Nov 6, 2020
5061688
Merge pull request #9 from IntelPython/mlir-lowerer-plier-rebased
Nov 9, 2020
1dec257
unary ops
Nov 12, 2020
aade610
div
Nov 12, 2020
42f3e39
get_const_val float
Nov 12, 2020
09cdbaf
setitem from numba ir
Nov 12, 2020
8de54d1
functions returning None
Nov 12, 2020
d8d6007
Merge pull request #123 from Hardcode84/my-develop
Nov 17, 2020
ee21735
loop continue
Nov 18, 2020
011499b
range index usage after loop
Nov 18, 2020
25209f4
test
Nov 18, 2020
d5a0a43
Merge pull request #126 from Hardcode84/extend-scf-rewrites
Nov 18, 2020
cd128c1
update llvm
Nov 20, 2020
f1e0286
Merge pull request #127 from Hardcode84/update-mlir
Nov 20, 2020
cfc6396
add jumps param
Nov 20, 2020
0d6e475
refac
Nov 20, 2020
e60e4e9
rework pipeline registry
Nov 20, 2020
bff7091
merge pippeline stages
Nov 20, 2020
33d71f4
module pipeline jump markers
Nov 20, 2020
5f18f00
Merge pull request #128 from Hardcode84/pipeline-control-flow
Nov 20, 2020
296070b
array len WIP
Nov 18, 2020
15df66f
pipeline control flow usage and fixes
Nov 20, 2020
e1d1840
Merge pull request #129 from Hardcode84/ndarray-len
Nov 20, 2020
591aa05
test
Nov 18, 2020
6c50632
work on setitem
Nov 20, 2020
a2f69aa
work on setitem
Nov 20, 2020
acc8f81
rerun_std_pipeline
Nov 20, 2020
322d63e
setitem lowering
Nov 24, 2020
1b8f9a4
fix
Nov 24, 2020
c6fd489
Merge pull request #131 from Hardcode84/array-setitem
Nov 24, 2020
8e2023d
refac
Nov 25, 2020
9184fcc
fix
Nov 26, 2020
aebda2c
refac
Nov 26, 2020
2ec2471
refactor function names
Nov 26, 2020
9e607fc
remove unused
Nov 26, 2020
0beedcd
func names registry
Nov 26, 2020
35ed5be
some math funcs support
Nov 27, 2020
c9123ff
Merge pull request #132 from Hardcode84/refactor-func-name
Nov 27, 2020
44a317c
remove get_module
Nov 27, 2020
57e92b4
make memref conversion funcs private
Nov 27, 2020
f44d52b
plier.fastmath
Nov 27, 2020
4cdf53d
refactor attributes
Nov 27, 2020
f2c3b33
alwaysinline
Nov 27, 2020
4f2c5bc
fastmath func flags
Nov 27, 2020
ded3bc3
update llvm
Nov 27, 2020
5599247
split linalg lowering into 2 phases
Nov 27, 2020
011e18a
update llvm
Dec 3, 2020
d1aa754
Merge pull request #133 from Hardcode84/mlir-som-refac
Dec 3, 2020
e985411
move MLIR settings to separate file, add soome instructions
Dec 9, 2020
29c638f
fix
Dec 9, 2020
64abc34
Merge pull request #140 from Hardcode84/mlir-readme
Dec 9, 2020
7cb9155
update MLIR (#141)
Dec 13, 2020
cdda461
update llvm (#144)
Dec 30, 2020
97311c7
[MLIR] Canonicalize reduction (#145)
Jan 1, 2021
6655498
[MLIR] Promote loops to parallel (#146)
Jan 2, 2021
7c9e138
LoopInvariantCodeMotion (#147)
Jan 2, 2021
d6d0b29
[MLIR] Prange func (#148)
Jan 2, 2021
310229e
[MLIR] tbb parallel backend (#149)
Jan 6, 2021
93256d7
some fixes to while-to-for lowering (#150)
Jan 6, 2021
fe438e8
[MLIR] Some fixes (#151)
Jan 7, 2021
af6b0da
update to llvm master (#152)
Jan 7, 2021
3bd3eb6
[MLIR] fastmath support (#153)
Jan 7, 2021
a38cfc2
[MLIR] refactor compiler machinery (#154)
Jan 8, 2021
60e7820
fixes for linux (#155)
Jan 12, 2021
6067d0c
option to dump plier before any passes (#156)
Jan 14, 2021
ae8f354
simple CSE rewrite (#157)
Jan 19, 2021
720e1fa
[MLIR] Getattr+global rewrite and CallRewrite simplification (#158)
Jan 19, 2021
c30bf74
[MLIR] call njit funcs from other njit funcs (#159)
Jan 19, 2021
b593a50
update to MLIR master (#160)
Jan 20, 2021
fda25f0
[MLIR] Some fixes (#161)
Jan 23, 2021
2682ad9
fix numpy.add (#162)
Jan 27, 2021
2fcb7e5
[MLIR] Range negative step (#163)
Jan 29, 2021
3939fcd
[MLIR] High level linalg api (#164)
Jan 30, 2021
7481a84
inplace binop (#165)
Jan 31, 2021
62b2aa2
[MLIR] Extend linalg builder (#166)
Jan 31, 2021
6dd2143
Mlir tuples (#167)
Feb 3, 2021
3637c33
[MLIR] Update to master (#168)
Feb 4, 2021
c086938
[MLIR] Some opts for array index access (#170)
Feb 6, 2021
1817405
[MLIR] Move rewrites tos separate files (#171)
Feb 6, 2021
7c26311
[MLIR] Separate python-agnostic parts into lib (#172)
Feb 8, 2021
11e0eaa
getZeroVal (#173)
Feb 8, 2021
954852c
modulo op (#174)
Feb 9, 2021
45da142
[MLIR] Return arrays from func (#183)
Feb 15, 2021
bcf4a35
[MLIR] array GetItem/SetItem multidim argument (#184)
Feb 16, 2021
f4a22a6
[MLIR] Numpy sqrt and square support (#185)
Feb 17, 2021
0d19002
[MLIR] Static setitem and array handling fixes (#186)
Feb 19, 2021
c22682f
[MLIR] Numpy empty and sum axis (#187)
Feb 21, 2021
ee7dfd7
[MLIR] Numpy dot, sum with axis, array.size, array.T (#188)
Feb 22, 2021
d22d464
[MLIR] tbb fixes (#189)
Feb 23, 2021
e5d1d72
some reshape support (#190)
Feb 26, 2021
8ad4823
some broadcasting support (#191)
Feb 26, 2021
22f3d43
[MLIR] Some numpy operators support (#192)
Feb 27, 2021
6d295aa
[MLIR] Numpy broadcasting (#193)
Feb 28, 2021
b3fe4a3
[MLIR] Use default SmallVec size, move readme file (#194)
Feb 28, 2021
b0900a5
[MLIR] some multiindex ParallelOp supports (#195)
Mar 1, 2021
c3061dc
fix (#196)
Mar 2, 2021
899647f
update to llvm master (#197)
Mar 2, 2021
bf50f4f
fix linux (#198)
Mar 3, 2021
4c147f6
[MLIR] Some linalg fixes and proper increfs/decrefs for array argumen…
Mar 3, 2021
bf8a729
[MLIR] Fusing optimizations (#200)
Mar 11, 2021
9ad86d3
Update to mlir master (#201)
Mar 13, 2021
948b8a2
add C language in cmake (#202)
Alexander-Makaryev Mar 16, 2021
f271a8e
add var for custom plier/dpcomp (#204)
Alexander-Makaryev Mar 17, 2021
71c8661
Use out-of-tree dpcomp sources (#206)
Mar 19, 2021
15bc678
[MLIR] Optimizations (#205)
Mar 19, 2021
c84a417
remove plier (#207)
Mar 19, 2021
9799bf2
control exported symbols (#208)
Alexander-Makaryev Mar 19, 2021
a9cc160
Darwin: another format for export symbols list (#209)
Alexander-Makaryev Mar 19, 2021
3a0c708
Refactor linalg optimizations flow (#210)
Mar 20, 2021
99de6b5
use new memory optimization (#211)
Mar 21, 2021
345e700
move mlir numba passes to mlir dir (#212)
Mar 22, 2021
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.nfs*
tags
MANIFEST
CMakeLists.txt.user

build/
docs/_build/
Expand Down
25 changes: 25 additions & 0 deletions mlir-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.5)

project(mlir_compiler LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory(mlir-compiler)

if(DEFINED DPCOMP_TREE)
message(STATUS "Out of tree PLIER is used")
add_subdirectory(${DPCOMP_TREE} plier)
elseif(DEFINED DPCOMP_DIR)
message(STATUS "PLIER from DPCOMP_DIR is used")
target_include_directories(${PROJECT_NAME} PRIVATE
${DPCOMP_DIR}/include
)
target_link_directories(${PROJECT_NAME} PRIVATE
${DPCOMP_DIR}
${DPCOMP_DIR}/Release
)
else()
message(FATAL_ERROR "dpcomp not found")
endif()
1 change: 1 addition & 0 deletions mlir-compiler/llvm-sha.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7b153b43d3a14d76975039408c4b922beb576735
76 changes: 76 additions & 0 deletions mlir-compiler/mlir-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

find_package(pybind11 REQUIRED)

find_package(LLVM REQUIRED CONFIG)
find_package(MLIR REQUIRED CONFIG)

list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(TableGen)
include(AddLLVM)
include(AddMLIR)
include(HandleLLVMOptions)

set(SOURCES_LIST
src/pipelines/base_pipeline.cpp
src/pipelines/lower_to_llvm.cpp
src/pipelines/parallel_to_tbb.cpp
src/pipelines/plier_to_linalg.cpp
src/pipelines/plier_to_std.cpp
src/lowering.cpp
src/mangle.cpp
src/py_func_resolver.cpp
src/py_linalg_resolver.cpp
src/py_map_types.cpp
src/py_module.cpp
)
set(HEADERS_LIST
src/pipelines/base_pipeline.hpp
src/pipelines/lower_to_llvm.hpp
src/pipelines/parallel_to_tbb.hpp
src/pipelines/plier_to_linalg.hpp
src/pipelines/plier_to_std.hpp
src/lowering.hpp
src/mangle.hpp
src/py_func_resolver.hpp
src/py_linalg_resolver.hpp
src/py_map_types.hpp
src/py_module.hpp
)

pybind11_add_module(${PROJECT_NAME} ${SOURCES_LIST} ${HEADERS_LIST})

if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /EHsc)
endif ()

if (CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_options(${PROJECT_NAME} PRIVATE "LINKER:--version-script=export.txt")
endif()

if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
target_link_libraries(${PROJECT_NAME} PRIVATE "-Wl,-exported_symbols_list,export_darwin.txt")
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE ${LLVM_DEFINITIONS})

target_link_libraries(${PROJECT_NAME} PRIVATE
plier
LLVM${LLVM_NATIVE_ARCH}CodeGen
LLVM${LLVM_NATIVE_ARCH}Desc
LLVMTarget
MLIRIR
MLIRLLVMIR
MLIRLLVMToLLVMIRTranslation
MLIRTransforms
MLIRStandardOpsTransforms
MLIRLinalgTransforms
MLIRSCFToStandard
MLIRTensorTransforms
)

target_include_directories(${PROJECT_NAME} PRIVATE
./src
${LLVM_INCLUDE_DIRS}
${MLIR_INCLUDE_DIRS}
)
4 changes: 4 additions & 0 deletions mlir-compiler/mlir-compiler/export.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
global: PyInit_mlir_compiler;
local: *;
};
1 change: 1 addition & 0 deletions mlir-compiler/mlir-compiler/export_darwin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_PyInit_mlir_compiler
Loading