Skip to content
Open
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
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ endfunction()
# Disable warnings that show up in external code (gtest;pybind11)
if(NOT MSVC)
if(FLAGTREE_BACKEND)
if(FLAGTREE_BACKEND MATCHES "^(enflame|hcu|thrive)$")
if(FLAGTREE_BACKEND MATCHES "^(enflame|hcu|thrive|evas)$")
# Suppress visibility warnings in gluon_ir.cc (GCC 13+ -Wattributes on pybind11 hidden types)
# Also suppress -Wcomment for generated TritonGPUAttrDefs.h.inc (ASCII diagrams in TableGen output)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-attributes -Wno-comment")
Expand Down Expand Up @@ -259,7 +259,7 @@ include_directories(${PROJECT_SOURCE_DIR}/third_party)
include_directories(${PROJECT_BINARY_DIR}/third_party) # Tablegen'd files

# link_directories(${LLVM_LIBRARY_DIR})
if (FLAGTREE_BACKEND MATCHES "^(cambricon|aipu|tsingmicro|enflame|thrive)$")
if (FLAGTREE_BACKEND MATCHES "^(cambricon|aipu|tsingmicro|enflame|thrive|evas)$")
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_BINARY_DIR}/include) # Tablegen'd files
add_subdirectory(include)
Expand Down Expand Up @@ -554,7 +554,7 @@ find_package(Threads REQUIRED)

add_subdirectory(third_party/f2reduce)

if(NOT FLAGTREE_BACKEND OR FLAGTREE_BACKEND MATCHES "^(aipu|tsingmicro|enflame|thrive)$")
if(NOT FLAGTREE_BACKEND OR FLAGTREE_BACKEND MATCHES "^(aipu|tsingmicro|enflame|thrive|evas)$")
add_subdirectory(bin)
if(FLAGTREE_TLE)
flagtree_add_tle_generated_header_dependencies()
Expand Down
15 changes: 15 additions & 0 deletions third_party/evas/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
__pycache__/
.cache/
*.py[cod]
*.egg-info/
.pytest_cache/
.mypy_cache/
build/
dist/
*.so
*.elf
*.mlir
*.log
accuracy_result.json
runtime/ev_torch/build/
runtime/ev_torch/ev_torch/lib/
59 changes: 59 additions & 0 deletions third_party/evas/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.20)

project(flagtree_evas LANGUAGES C CXX)

include(FetchContent)

set(EVAS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(EVAS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")

set(TRITON_SHARED_GIT_REPOSITORY
"https://github.com/facebookincubator/triton-shared.git")
set(TRITON_SHARED_GIT_TAG "e0c513317d9e7838b00730fd494e3372400e93db")
set(TRITON_SHARED_SOURCE_DIR "${EVAS_BINARY_DIR}/_deps/evas_triton_shared-src")
set(TRITON_SHARED_BINARY_DIR "${EVAS_BINARY_DIR}/third_party/triton_shared")
set(TRITON_SHARED_LLVM_COMPAT_PATCH
"${EVAS_SOURCE_DIR}/patches/triton-shared-llvm22-compat.patch")

if(NOT EXISTS "${TRITON_SHARED_LLVM_COMPAT_PATCH}")
message(FATAL_ERROR "missing triton_shared compatibility patch: ${TRITON_SHARED_LLVM_COMPAT_PATCH}")
endif()

if(NOT TARGET TritonSharedAnalysis)
find_package(Git REQUIRED)
FetchContent_Declare(
evas_triton_shared
GIT_REPOSITORY "${TRITON_SHARED_GIT_REPOSITORY}"
GIT_TAG "${TRITON_SHARED_GIT_TAG}"
PATCH_COMMAND
"${CMAKE_COMMAND}" -E chdir <SOURCE_DIR> /bin/bash -c
"\"${GIT_EXECUTABLE}\" apply --check \"${TRITON_SHARED_LLVM_COMPAT_PATCH}\" && \"${GIT_EXECUTABLE}\" apply \"${TRITON_SHARED_LLVM_COMPAT_PATCH}\" || \"${GIT_EXECUTABLE}\" apply --reverse --check \"${TRITON_SHARED_LLVM_COMPAT_PATCH}\"")
FetchContent_GetProperties(evas_triton_shared)
if(NOT evas_triton_shared_POPULATED)
FetchContent_Populate(evas_triton_shared)
endif()

set(TRITON_SHARED_SOURCE_DIR "${evas_triton_shared_SOURCE_DIR}")
add_subdirectory("${TRITON_SHARED_SOURCE_DIR}" "${TRITON_SHARED_BINARY_DIR}")
endif()

set(TRITON_SHARED_TOOLS_DIR "${TRITON_SHARED_SOURCE_DIR}/tools/triton-shared-opt")

include_directories(${EVAS_SOURCE_DIR}/include)
include_directories(${EVAS_BINARY_DIR}/include)
include_directories(${EVAS_SOURCE_DIR}/backend/include)
include_directories(${TRITON_SHARED_SOURCE_DIR}/include)
include_directories(${TRITON_SHARED_BINARY_DIR}/include)

add_subdirectory(include/evas/Dialect/Linalg/IR)
add_subdirectory(include/evas/Transform/Linalg)

add_subdirectory(lib/Dialect/Linalg/IR)
add_subdirectory(lib/Transform/Linalg)
add_subdirectory(lib/Conversion/TritonToEvas)
add_subdirectory(bin/evas-triton-opt)

if(TRITON_BUILD_PYTHON_MODULE AND COMMAND add_triton_plugin)
add_triton_plugin(TritonEVAS ${EVAS_SOURCE_DIR}/backend/triton_evas.cc)
target_link_libraries(TritonEVAS PRIVATE Python3::Module pybind11::headers)
endif()
1 change: 1 addition & 0 deletions third_party/evas/backend/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# EVAS Triton backend package.
1 change: 1 addition & 0 deletions third_party/evas/backend/compiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from triton.backends.evas.evas import EvasBackend
2 changes: 2 additions & 0 deletions third_party/evas/backend/driver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from triton.backends.evas.evas import EvasDriver as ActiveDriver

Loading
Loading