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
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ include(CTest)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(_triton_plugins_default ON)
if (WIN32)
set(_triton_plugins_default OFF)
endif()

# Options
option(TRITON_BUILD_PYTHON_MODULE "Build Python Triton bindings" OFF)
option(TRITON_BUILD_PROTON "Build the Triton Proton profiler" ON)
Expand All @@ -23,6 +28,7 @@ option(TRITON_BUILD_WITH_CCACHE "Build with ccache (if available)" ON)
option(TRITON_OFFLINE_BUILD "Build without downloading dependencies" OFF)
option(LLVM_BUILD_SHARED_LIBS
"Build all libraries as shared libraries instead of static" OFF)
option(TRITON_ENABLE_PLUGINS "Enable building Triton plugins" ${_triton_plugins_default})
set(TRITON_CODEGEN_BACKENDS "" CACHE STRING "Enable different codegen backends")

set(TRITON_CACHE_PATH "" CACHE PATH "Path to triton cache")
Expand All @@ -38,6 +44,10 @@ set(TRITON_CUDART_PATH "" CACHE PATH "Path to CUDA Runtime headers")
set(TRITON_CUPTI_INCLUDE_PATH "" CACHE PATH "Path to CUPTI headers")
set(TRITON_CUPTI_LIB_PATH "" CACHE PATH "Path to CUPTI libraries")

if (WIN32 AND TRITON_ENABLE_PLUGINS)
message(FATAL_ERROR "TRITON_ENABLE_PLUGINS=ON is not supported on Windows.")
endif()

if(NOT TRITON_CACHE_PATH)
message(FATAL_ERROR "TRITON_CACHE_PATH must be set or derivable from TRITON_HOME/HOME/USERPROFILE/HOMEPATH.")
endif()
Expand Down
5 changes: 5 additions & 0 deletions examples/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
if (NOT TRITON_ENABLE_PLUGINS)
message(STATUS "TRITON_ENABLE_PLUGINS=OFF: skipping Triton example plugin libraries")
return()
endif()

set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls -name Plugins)
add_public_tablegen_target(TritonPluginsIncGen)
Expand Down
2 changes: 1 addition & 1 deletion test/Plugins/test-dialect-plugin.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: TRITON_PASS_PLUGIN_PATH=%shlibdir/../plugins/libMLIRDialectPlugin.so triton-opt -split-input-file --convert-plugin-gpu-to-llvm --convert-triton-gpu-to-llvm %s | \
// RUN: FileCheck %s

// REQUIRES: shared-libs
// REQUIRES: plugins, shared-libs

#blocked0 = #ttg.blocked<{sizePerThread = [8], threadsPerWarp = [32], warpsPerCTA = [8], order = [0]}>
module attributes {"ttg.num-warps" = 8 : i32} {
Expand Down
2 changes: 1 addition & 1 deletion test/Plugins/test-plugin.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: TRITON_PASS_PLUGIN_PATH=%shlibdir/../plugins/libTritonPluginsTestLib.so triton-opt -split-input-file %s | FileCheck %s -allow-unused-prefixes --check-prefix=CHECK-NOFLAG
// RUN: triton-opt -split-input-file %s | FileCheck %s -allow-unused-prefixes --check-prefix=CHECK-BASE

// REQUIRES: shared-libs
// REQUIRES: plugins, shared-libs

module attributes {"ttg.num-warps" = 4 : i32, "ttg.target" = "cuda:80"} {
// CHECK-PLUGIN: func @foo()
Expand Down
4 changes: 4 additions & 0 deletions test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
ToolSubst('%PYTHON', config.python_executable, unresolved='ignore'),
]

# Example plugins are not built if TRITON_ENABLE_PLUGINS is OFF.
if config.enable_plugins:
config.available_features.add("plugins")

# Static libraries are not built if LLVM_BUILD_SHARED_LIBS is ON.
if config.build_shared_libs:
config.available_features.add("shared-libs")
Expand Down
1 change: 1 addition & 0 deletions test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ config.llvm_exe_ext = "@EXEEXT@"
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.mlir_binary_dir = "@MLIR_BINARY_DIR@"
config.python_executable = "@Python3_EXECUTABLE@"
config.enable_plugins = "@TRITON_ENABLE_PLUGINS@"
config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@
config.build_shared_libs = @LLVM_BUILD_SHARED_LIBS@

Expand Down