Skip to content

Commit

Permalink
Merge branch 'main' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreEichenberger authored Jun 14, 2023
2 parents 994e866 + 02af5ac commit 0c8ab1c
Show file tree
Hide file tree
Showing 259 changed files with 10,509 additions and 8,292 deletions.
2 changes: 1 addition & 1 deletion .buildbot/jenkins-build-llvm-project.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
LLVM_PROJECT_SHA1_REGEX = 'git checkout ([0-9a-f]+)'
LLVM_PROJECT_DOCKERFILE = 'docker/Dockerfile.llvm-project'
LLVM_PROJECT_GITHUB_URL = 'https://api.github.com/repos/llvm/llvm-project'
BASE_IMAGE = { 'static': 'ubuntu:focal',
BASE_IMAGE = { 'static': 'ubuntu:jammy',
'shared': 'registry.access.redhat.com/ubi8-minimal:latest' }
LLVM_PROJECT_IMAGE = { 'static': docker_static_image_name,
'shared': docker_shared_image_name }
Expand Down
2 changes: 1 addition & 1 deletion .buildbot/jenkins-watch-llvm-project.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
github_repo_access_token = os.getenv('GITHUB_REPO_ACCESS_TOKEN')
jenkins_rest_api_token = os.getenv('JENKINS_REST_API_TOKEN')

LLVM_PROJECT_BASE_IMAGE = 'ubuntu:focal'
LLVM_PROJECT_BASE_IMAGE = 'ubuntu:jammy'
LLVM_PROJECT_WATCH_IMAGE = 'llvm-project-watch'
LLVM_PROJECT_GITHUB_URL = 'https://api.github.com/repos/llvm/llvm-project'
LLVM_PROJECT_SHA1_REGEX = 'git checkout ([0-9a-f]+)'
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile.llvm-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# By default, use ubuntu:jammy
# By default, use ubuntu:jammy, remember to change Jenkins build script as well
ARG BASE_IMAGE="ubuntu:jammy"
FROM ${BASE_IMAGE}

Expand Down Expand Up @@ -89,6 +89,7 @@ RUN git clone -n https://github.com/llvm/llvm-project.git \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_LIBEDIT=OFF \
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} \
&& cmake --build . --parallel ${NPROC} -- ${MAKEFLAGS} \
&& (cmake --build . --parallel ${NPROC} --target check-mlir || \
Expand Down
5 changes: 3 additions & 2 deletions docs/BuildOnLinuxOSX.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Firstly, install MLIR (as a part of LLVM-Project):
``` bash
git clone -n https://github.com/llvm/llvm-project.git
# Check out a specific branch that is known to work with ONNX-MLIR.
cd llvm-project && git checkout 3abae1c88416858cf2e9a7ed9417bc52033933b4 && cd ..
cd llvm-project && git checkout 6cf7fe4a9a715bcdf3f4913753109e22dfc9940b && cd ..
```

[same-as-file]: <> (utils/build-mlir.sh)
Expand All @@ -26,7 +26,8 @@ cmake -G Ninja ../llvm \
-DLLVM_TARGETS_TO_BUILD="host" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_RTTI=ON
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_LIBEDIT=OFF

cmake --build . -- ${MAKEFLAGS}
cmake --build . --target check-mlir
Expand Down
5 changes: 3 additions & 2 deletions docs/BuildOnWindows.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Install MLIR (as a part of LLVM-Project):
```shell
git clone -n https://github.com/llvm/llvm-project.git
# Check out a specific branch that is known to work with ONNX-MLIR.
cd llvm-project && git checkout 3abae1c88416858cf2e9a7ed9417bc52033933b4 && cd ..
cd llvm-project && git checkout 6cf7fe4a9a715bcdf3f4913753109e22dfc9940b && cd ..
```

[same-as-file]: <> (utils/build-mlir.cmd)
Expand All @@ -68,7 +68,8 @@ call cmake %root_dir%\llvm-project\llvm -G "Ninja" ^
-DLLVM_ENABLE_ASSERTIONS=ON ^
-DLLVM_ENABLE_RTTI=ON ^
-DLLVM_ENABLE_ZLIB=OFF ^
-DLLVM_INSTALL_UTILS=ON
-DLLVM_INSTALL_UTILS=ON ^
-DLLVM_ENABLE_LIBEDIT=OFF

call cmake --build . --config Release
call cmake --build . --config Release --target install
Expand Down
43 changes: 27 additions & 16 deletions docs/Dialects/krnl.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,32 @@ means to block the for loop referred to by %i using a tile size of 4.

call operation

The call operation provides a generic way to call an external function
at Krnl level. The `funcName` determines which function to call.
The `result` is the Value to store the function return. Currently only
one output is supported. The `result` has to be resulted memref.
Since resolution of the output MemRef involves shape inference on ONNX Op,
resolution should be done at lowering ONNX Op, not within krnl.Call.
Another reason is that Krnl.call need to be defined with AllocationOp
interface if `result` is allocated inside this Op.
The parameters can be of any type: MemRef, NoneType or any llvm type.
Different types of parameters will be converted, if needed, when KrnlCallOp
is lowered. Attributes will be converted to parameters too (To be Added).
The function signature will be determined with the types of parameters.
An LLVM::CallOp to either a runtime library or a llvm intrinsic function
will be generated.
The krnl.call op will be lowered to llvm at krnl-to-llvm conversion.
The call operation provides a generic way to replace an ONNX Op with a call
to an external function at Krnl level.
`funcName` attributes determines which function to call.
`parameters` is the inputs to Krnl.Call. It includes the outputs and inputs
of the ONNX Op. The outputs and inputs are already lowered to MemRefs.
The external function is assumed NOT to allocate or free any memory.
'numOfOutput` attribute to tell how manu outputs Memref in parameters.
mlir::OpTrait::AttrSizedOperandSegments is not used to put outputs and
inputs into separate variadic parameters because I am thinking of mixing
the inputs and outpus as required by external library.

The attributes of the ONNX Op will be copied to KrnlCallOp under the control
of the user.
In Krnl To llvm lowering, the parameters and attributes will be lowered to
parameters of the llvm function call.

Several builder is defined to help translating an ONNX Op to Krnl.Call.
User can provides the allocated MemRefs for outputs and the inputs
separately. The inputs are usually the operands of the ONNX Op.
The attributes of ONNX Op can be copied or not copied based on a bool
parameter in the builder. Builder also provide a mechanism for user
to selectively copy some attributes.

The krnl.call op will be lowered to llvm at krnl-to-llvm conversion in which
OMTensor is used as a container for MemRef arguments. Other representation
of parameters, such as data pointer only, will be supported in future.

Interfaces: MemoryEffectOpInterface

Expand All @@ -170,12 +181,12 @@ Interfaces: MemoryEffectOpInterface
| Attribute | MLIR Type | Description |
| :-------: | :-------: | ----------- |
| `funcName` | ::mlir::StringAttr | string attribute
| `numOfOutput` | ::mlir::IntegerAttr | 64-bit signed integer attribute

#### Operands:

| Operand | Description |
| :-----: | ----------- |
| `result` | any type
| `parameters` | any type

### `krnl.copy_from_tile_buffer` (::mlir::KrnlCopyFromBufferOp)
Expand Down
Loading

0 comments on commit 0c8ab1c

Please sign in to comment.