Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,13 @@ set(BENCH_KERNLES_FILES
)

set(SRC_INTERFACE_FILES
TensorUtils.h
Contraction.cpp
Einsum.cpp
Einsum.h
Gemm.cpp
Tensor.cpp
TensorUtils.h
Unary.cpp
)

set(TEST_INTERFACE_FILES
Expand Down Expand Up @@ -326,6 +331,8 @@ endforeach()
# ==== Public headers of the installed library ====
set(public_headers
include/${PROJECT_NAME}/Tensor.h
include/${PROJECT_NAME}/Error.h
include/${PROJECT_NAME}/UnaryType.h
)

list(APPEND TEST_FILEPATHS "${INTERFACE_FILEPATHS}" "${public_headers}")
Expand Down Expand Up @@ -436,7 +443,7 @@ target_include_directories(${PROJECT_NAME}
PUBLIC
# using the project name as additional directory to include <project_name>/header.h instead of header.h if it is included as internal library
# where top-level project will look for the library's public headers
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# where external projects will look for the library's public headers
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
Expand Down Expand Up @@ -471,6 +478,7 @@ install(EXPORT "${PROJECT_NAME}Targets"
NAMESPACE ${namespace}::
DESTINATION cmake
)
add_library(mlc::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

include(CMakePackageConfigHelpers)

Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Machine Learning Compilers

This repository was created as part of the **Machine Learning Compilers** lecture and lab at Friedrich Schiller University Jena during the summer term 2025. While the lecture focused on theoretical concepts, the lab had a practical orientation, with the goal of implementing a domain-specific compiler for tensor expressions.

The main objective of the lab was to build a Just-In-Time (JIT) compiler from scratch that supports a variety of tensor operations. Tensor compilers automate the transformation of tensor expressions into executable code, aiming for high throughput, low latency, short compile times, flexibility and portability.

The lab involved weekly tasks that guided the development of this compiler. The corresponding code and implementations are part of this repository.

## Overview

This repository includes:

- Implementations of all lab tasks
- Source code of a functional JIT compiler for tensor operations
- Modular code structured for reuse and extensibility

The weekly tasks from the lab can be found here: [scalable-analyses](https://github.com/scalable-analyses/pbtc/tree/main/lab)

## Technical Documentation

A detailed technical documentation of our implementation including the design decisions and solutions to the lab tasks, and explanations of the source code is available on our [project website](https://integer-ctrl.github.io/machine-learning-compilers/).

## CMake Library

To make the compiler easy to integrate into other projects, we structured it as a CMake library. This allows users to include and build upon our functionality directly in their own CMake-based projects. More details about the library and how to use it can be found in the [user-guide.md](https://github.com/Integer-Ctrl/machine-learning-compilers/cmake-library/user-guide.md).
58 changes: 58 additions & 0 deletions cmake-library/example-project/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 3.28.0)
project(ExampleProject VERSION 0.1.0 LANGUAGES C CXX ASM)

# The MachineLearningCompiler library is only supported on Linux on arm.
if(NOT (UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm)"))
message(FATAL_ERROR "Only arm on Linux is supported.")
endif()


# Set default build type to Release if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(IS_MULTI_CONFIG)
message(NOTICE "Using multi-config generator. Compile with: cmake --build . --config [Debug|Release] --target <target>")
else()
message(NOTICE "Using single-config generator. Generate with: cmake .. -DCMAKE_BUILD_TYPE=[Debug|Release]")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(WARNING "No Build type is set. Using Release!")
endif()
endif()

message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")


# ===========================================
# Include the MachineLearningCompiler Library
# ===========================================

# Option 1: Including the MachineLearningCompiler Library

# Optional: Toggles if included libraries is build as shared or static libraries. Default is ON.
set(BUILD_SHARED_LIBS ON)

# Optional: Toggles if OpenMP should be used by the library. Default is ON.
set(MLC_USE_OPENMP ON)

Include(FetchContent)
FetchContent_Declare(
MachineLearningCompiler
GIT_REPOSITORY https://github.com/Integer-Ctrl/machine-learning-compilers
GIT_TAG individual-phase #TODO change
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(MachineLearningCompiler)

# Option 2: Include it from the the current machine if installed.
# find_library(mlc::MachineLearningCompiler)

# ===========================================

add_executable(example
Example.cpp
)
target_link_libraries(example mlc::MachineLearningCompiler)
Loading