-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* poc * tensor overloads wip * torch types wip * add test suite and start porting `torch.nn.Module` * autogenerate from jitop registry torch_ext.py * generete python wrappers * sketch functional.py * smoke test done * bump version * rename package to pi * change names/strings/comments
- Loading branch information
1 parent
649d588
commit 8816fa9
Showing
95 changed files
with
30,616 additions
and
872 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- nn_module | ||
push: | ||
branches: | ||
- main | ||
- nn_module | ||
workflow_dispatch: | ||
branches: | ||
- main | ||
- nn_module | ||
|
||
jobs: | ||
|
||
test-against-torch-mlir: | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
arch: [ x86_64 ] | ||
python_version: [ "3.10" ] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# - name: Install linux system packages | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get -y install ninja-build cmake clang | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
|
||
- name: Install | ||
run: | | ||
pip install . \ | ||
--pre torch-mlir torchvision \ | ||
-f https://llvm.github.io/torch-mlir/package-index/ \ | ||
--extra-index-url https://download.pytorch.org/whl/nightly/cpu \ | ||
-v | ||
- name: Test vs. torch-mlir | ||
run: | | ||
PYTHONPATH=tests/torch_mlir python tests/torch_mlir/main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
cmake_minimum_required(VERSION 3.13.4) | ||
|
||
if (POLICY CMP0068) | ||
cmake_policy(SET CMP0068 NEW) | ||
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) | ||
endif () | ||
|
||
if (POLICY CMP0075) | ||
cmake_policy(SET CMP0075 NEW) | ||
endif () | ||
|
||
if (POLICY CMP0077) | ||
cmake_policy(SET CMP0077 NEW) | ||
endif () | ||
|
||
if (POLICY CMP0116) | ||
cmake_policy(SET CMP0116 NEW) | ||
endif () | ||
|
||
project(PI LANGUAGES CXX C) | ||
|
||
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) | ||
|
||
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") | ||
|
||
find_package(MLIR REQUIRED CONFIG) | ||
|
||
message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}") | ||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") | ||
|
||
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin) | ||
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib) | ||
set(MLIR_BINARY_DIR ${CMAKE_BINARY_DIR}) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}") | ||
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") | ||
include(TableGen) | ||
include(AddLLVM) | ||
include(AddMLIR) | ||
include(HandleLLVMOptions) | ||
|
||
include_directories(${LLVM_INCLUDE_DIRS}) | ||
include_directories(${MLIR_INCLUDE_DIRS}) | ||
link_directories(${LLVM_BUILD_LIBRARY_DIR}) | ||
add_definitions(${LLVM_DEFINITIONS}) | ||
|
||
##################################### Bindings path hacks | ||
|
||
include(MLIRDetectPythonEnv) | ||
include(AddMLIRPython) | ||
mlir_configure_python_dev_packages() | ||
mlir_detect_pybind11_install() | ||
|
||
set(PYTHON_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cpp_ext) # --src-root | ||
set(MLIR_BINARY_DIR ${CMAKE_BINARY_DIR}) | ||
# set(MLIR_TABLEGEN_EXE "" CACHE STRING "Path to mlir-tablegen") | ||
# message(STATUS "MLIR_TABLEGEN_EXE: ${MLIR_TABLEGEN_EXE}") | ||
set(MLIR_INCLUDE_TESTS 0) | ||
|
||
pybind11_add_module(_mlir cpp_ext/MainModule.cpp cpp_ext/TensorValue.cpp cpp_ext/TorchTypes.cpp) | ||
#target_link_libraries(_mlir PRIVATE MLIRIR MLIRSupport MLIRCAPIInterfaces MLIRCAPIIR) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.