[BUILD] use Python Var In Tests (#859)

This commit is contained in:
Ian Bearman
2022-11-08 09:44:19 -08:00
committed by GitHub
parent 137344946f
commit 303790da88
3 changed files with 7 additions and 5 deletions

View File

@@ -15,6 +15,10 @@ endif()
option(TRITON_BUILD_TUTORIALS "Build C++ Triton tutorials" ON) option(TRITON_BUILD_TUTORIALS "Build C++ Triton tutorials" ON)
option(TRITON_BUILD_PYTHON_MODULE "Build Python Triton bindings" OFF) option(TRITON_BUILD_PYTHON_MODULE "Build Python Triton bindings" OFF)
# Ensure Python3 vars are set correctly
# used conditionally in this file and by lit tests
find_package(Python3 REQUIRED COMPONENTS Development Interpreter)
# Default build type # Default build type
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Default build type: Release") message(STATUS "Default build type: Release")
@@ -133,24 +137,22 @@ endif()
if(TRITON_BUILD_PYTHON_MODULE) if(TRITON_BUILD_PYTHON_MODULE)
message(STATUS "Adding Python module") message(STATUS "Adding Python module")
set(PYTHON_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/python/src) set(PYTHON_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/python/src)
set(PYTHON_SRC ${PYTHON_SRC_PATH}/main.cc ${PYTHON_SRC_PATH}/triton.cc)
include_directories("." ${PYTHON_SRC_PATH}) include_directories("." ${PYTHON_SRC_PATH})
if (PYTHON_INCLUDE_DIRS) if (PYTHON_INCLUDE_DIRS)
include_directories(${PYTHON_INCLUDE_DIRS}) include_directories(${PYTHON_INCLUDE_DIRS})
else() else()
find_package(Python3 REQUIRED COMPONENTS Development)
include_directories(${Python3_INCLUDE_DIRS}) include_directories(${Python3_INCLUDE_DIRS})
link_directories(${Python3_LIBRARY_DIRS}) link_directories(${Python3_LIBRARY_DIRS})
link_libraries(${Python3_LIBRARIES}) link_libraries(${Python3_LIBRARIES})
add_link_options(${Python3_LINK_OPTIONS}) add_link_options(${Python3_LINK_OPTIONS})
endif() endif()
set(PYTHON_SRC ${PYTHON_SRC_PATH}/main.cc ${PYTHON_SRC_PATH}/triton.cc)
endif() endif()
# # Triton # # Triton
# file(GLOB_RECURSE LIBTRITON_SRC lib/*.cc) # file(GLOB_RECURSE LIBTRITON_SRC lib/*.cc)
# if (WIN32 AND TRITON_BUILD_PYTHON_MODULE) # if (WIN32 AND TRITON_BUILD_PYTHON_MODULE)
# find_package(Python3 REQUIRED COMPONENTS Development)
# Python3_add_library(triton SHARED ${LIBTRITON_SRC} ${PYTHON_SRC}) # Python3_add_library(triton SHARED ${LIBTRITON_SRC} ${PYTHON_SRC})
# set_target_properties(triton PROPERTIES SUFFIX ".pyd") # set_target_properties(triton PROPERTIES SUFFIX ".pyd")
# set_target_properties(triton PROPERTIES PREFIX "lib") # set_target_properties(triton PROPERTIES PREFIX "lib")

View File

@@ -1,4 +1,4 @@
// RUN: python3 -m triton.tools.aot %s --target=llvm-ir | FileCheck %s // RUN: %PYTHON -m triton.tools.aot %s --target=llvm-ir | FileCheck %s
// == LLVM IR check begin == // == LLVM IR check begin ==
// CHECK-LABEL: ; ModuleID = 'LLVMDialectModule' // CHECK-LABEL: ; ModuleID = 'LLVMDialectModule'

View File

@@ -1,4 +1,4 @@
// RUN: python3 -m triton.tools.aot %s --target=ptx --sm=80 --ptx-version=63 | FileCheck %s // RUN: %PYTHON -m triton.tools.aot %s --target=ptx --sm=80 --ptx-version=63 | FileCheck %s
// CHECK-LABEL: // Generated by LLVM NVPTX Back-End // CHECK-LABEL: // Generated by LLVM NVPTX Back-End
// CHECK: .version 6.3 // CHECK: .version 6.3
// CHECK: .target sm_80 // CHECK: .target sm_80