Skip to content

Commit

Permalink
WIP CI
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksKnezevic committed Sep 18, 2024
1 parent a70dfdd commit 1fde6df
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 41 deletions.
28 changes: 0 additions & 28 deletions .github/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,6 @@ RUN cmake -B toolchain -DTOOLCHAIN=ON third_party/ && \
cmake -B env/build env && \
cmake --build env/build

# Self-test

# Build project to test the container
RUN source env/activate && \
cmake -G Ninja \
-B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DTTMLIR_ENABLE_RUNTIME=ON \
-DTTMLIR_ENABLE_RUNTIME_TESTS=ON \
-DTTMLIR_ENABLE_STABLEHLO=ON

RUN source env/activate && \
cmake --build build --config Release

RUN source env/activate && \
cmake --build build -- ttrt

# Run clang-tidy
RUN source env/activate && \
cmake --build build -- clang-tidy

# Run the tests
RUN source env/activate && \
cmake --build build -- check-ttmlir

# Final stage
FROM ghcr.io/tenstorrent/tt-xla/tt-xla-base-ubuntu-22-04:${FROM_TAG} AS ci

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: |
source venv/activate
cmake -G Ninja \
-B ${{ steps.strings.outputs.build-output-dir }}
-B ${{ steps.strings.outputs.build-output-dir }} \
-S ${{ steps.strings.outputs.work-dir }}
- name: Build
Expand All @@ -60,14 +60,14 @@ jobs:
# https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss
- name: 'Tar install directory'
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: tar cvf artifact.tar .

- name: Upload install folder to archive
uses: actions/upload-artifact@v4
with:
name: install-artifacts
path: ${{ steps.strings.outputs.install-output-dir }}/artifact.tar
path: ${{ steps.strings.outputs.build-output-dir }}/artifact.tar

- name: Get the latest tag
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")

set(CMAKE_INSTALL_PREFIX ${TTPJRT_SOURCE_DIR}/install)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)

# set(ASAN_FLAGS "-fsanitize=address -fno-omit-frame-pointer")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ASAN_FLAGS}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand Down
12 changes: 7 additions & 5 deletions src/tt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ target_link_libraries(TTPJRTTTDylib PUBLIC TTPJRTTT)

# # Output to the project wide python binary directory tree.
set_target_properties(TTPJRTTTDylib
PROPERTIES
PREFIX "" # Disable "lib" prefix.
LIBRARY_OUTPUT_NAME pjrt_plugin_tt
RUNTIME_OUTPUT_DIRECTORY "${_NATIVE_PYTHON_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${_NATIVE_PYTHON_DIR}"
PROPERTIES
PREFIX "" # Disable "lib" prefix.
LIBRARY_OUTPUT_NAME pjrt_plugin_tt
# RUNTIME_OUTPUT_DIRECTORY "${_NATIVE_PYTHON_DIR}"
# LIBRARY_OUTPUT_DIRECTORY "${_NATIVE_PYTHON_DIR}"
INSTALL_RPATH_USE_LINK_PATH TRUE
)
install(TARGETS TTPJRTTTDylib DESTINATION lib)

target_link_options(TTPJRTTTDylib PRIVATE "-Wl,--no-undefined")

Expand Down
2 changes: 1 addition & 1 deletion tests/TTIR/test_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def module_relu(a):

verify_module(module_relu, [(32, 32)])

# @pytest.mark.xfail
@pytest.mark.xfail
def test_softmax():
def module_softmax(a):
return jax.nn.softmax(a)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import jax._src.xla_bridge as xb

def initialize():
path = os.path.join(os.path.dirname(__file__), "../build/src/tt/pjrt_plugin_tt.so")
path = os.path.join(os.path.dirname(__file__), "../install/lib/pjrt_plugin_tt.so")
if not os.path.exists(path):
raise FileNotFoundError(f"Could not find tt_pjrt C API plugin at {path}, have you compiled the project?")

Expand Down
12 changes: 9 additions & 3 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(TT_MLIR_VERSION "f955a08e8836e41a3333ca20a3bbe193ce91b2a0")
set(TT_MLIR_VERSION "a4628f8e8fe900ec64bd96565d80a487b76f5755")
set(LOGURU_VERSION "4adaa185883e3c04da25913579c451d3c32cfac1")

if (TOOLCHAIN STREQUAL "ON")
Expand All @@ -19,7 +19,7 @@ if (TOOLCHAIN STREQUAL "ON")
else()
include(ExternalProject)
add_subdirectory(pjrt_c_api)
set(TTMLIR_LIB_DIR ${PROJECT_SOURCE_DIR}/third_party/tt-mlir/src/tt-mlir-build/lib/SharedLib)
set(TTMLIR_LIB_DIR ${TTPJRT_SOURCE_DIR}/install)
ExternalProject_Add(
tt-mlir
PREFIX ${TTPJRT_SOURCE_DIR}/third_party/tt-mlir
Expand All @@ -31,12 +31,18 @@ else()
-DTT_RUNTIME_ENABLE_TTNN=ON
-DTTMLIR_ENABLE_STABLEHLO=ON
-DTTMLIR_ENABLE_RUNTIME=ON
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
GIT_REPOSITORY [email protected]:tenstorrent/tt-mlir.git
GIT_TAG ${TT_MLIR_VERSION}
GIT_PROGRESS ON
INSTALL_COMMAND ""
)

# #TODO: Remove this once we have a proper install target
# message(STATUS "Copying ttmetal libraries from ${PROJECT_SOURCE_DIR}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal-build/lib to ${TTMLIR_LIB_DIR}/lib")
# execute_process(
# COMMAND /bin/bash -c "mkdir -p ${TTMLIR_LIB_DIR}/lib/ && cp ${PROJECT_SOURCE_DIR}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal-build/lib/* ${TTMLIR_LIB_DIR}/lib/"
# )

set_target_properties(tt-mlir PROPERTIES EXCLUDE_FROM_ALL TRUE)

# Link to all TTMLIR libraries in ${TTMLIR_INSTALL_DIR}/install/lib
Expand Down

0 comments on commit 1fde6df

Please sign in to comment.