Fixed Python link bug in CMakeLists

This commit is contained in:
Philippe Tillet
2022-04-25 11:38:16 -07:00
parent 9e304cf79d
commit 62a64ff29b
2 changed files with 14 additions and 12 deletions

View File

@@ -37,7 +37,7 @@ if(WIN32)
add_subdirectory(deps/dlfcn-win32/src ${CMAKE_BINARY_DIR}/dlfcn-win32) add_subdirectory(deps/dlfcn-win32/src ${CMAKE_BINARY_DIR}/dlfcn-win32)
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS -std=gnu++17") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS -fPIC -std=gnu++17")
########## ##########
@@ -162,7 +162,7 @@ list(APPEND CMAKE_MODULE_PATH ${LLVM_LIBRARY_DIR}/cmake/mlir)
include(TableGen) # required by AddMLIR include(TableGen) # required by AddMLIR
include(AddLLVM) include(AddLLVM)
include(AddMLIR) include(AddMLIR)
include(HandleLLVMOptions) # human-friendly error message # include(HandleLLVMOptions) # human-friendly error message
include_directories(${MLIR_INCLUDE_DIRS}) include_directories(${MLIR_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/include) include_directories(${PROJECT_SOURCE_DIR}/include)
@@ -174,18 +174,15 @@ add_subdirectory(lib)
add_library(triton SHARED ${PYTHON_SRC}) add_library(triton SHARED ${PYTHON_SRC})
find_package(PythonLibs REQUIRED) # find_package(PythonLibs REQUIRED)
target_link_libraries(triton target_link_libraries(triton
${PYTHON_LIBRARIES}
TritonIR TritonIR
TritonDriver TritonDriver
# TritonCodeGen
# optimizations # optimizations
MLIRPass MLIRPass
MLIRTransforms MLIRTransforms
${PYTHON_LIBRARIES}
) )
target_link_options(triton PRIVATE ${LLVM_LDFLAGS}) target_link_options(triton PRIVATE ${LLVM_LDFLAGS})

View File

@@ -19,7 +19,8 @@ namespace triton
namespace nvrtc namespace nvrtc
{ {
#define TRITON_CREATE_NVRTC_EXCEPTION(name, msg) class name: public std::exception { public: const char * what() const throw(){ return "NVRTC: Error- " msg; } } #define TRITON_CREATE_NVRTC_EXCEPTION(name, msg) \
class name: public std::exception { public: const char * what() const throw() override { return "NVRTC: Error- " msg; } }
TRITON_CREATE_NVRTC_EXCEPTION(out_of_memory ,"out of memory"); TRITON_CREATE_NVRTC_EXCEPTION(out_of_memory ,"out of memory");
TRITON_CREATE_NVRTC_EXCEPTION(program_creation_failure ,"program creation failure"); TRITON_CREATE_NVRTC_EXCEPTION(program_creation_failure ,"program creation failure");
@@ -38,7 +39,8 @@ namespace triton
{ {
class base: public std::exception{}; class base: public std::exception{};
#define TRITON_CREATE_CUDA_EXCEPTION(name, msg) class name: public base { public:const char * what() const throw(){ return "CUDA: Error- " msg; } } #define TRITON_CREATE_CUDA_EXCEPTION(name, msg) \
class name: public base { public:const char * what() const throw() override { return "CUDA: Error- " msg; } }
TRITON_CREATE_CUDA_EXCEPTION(invalid_value ,"invalid value"); TRITON_CREATE_CUDA_EXCEPTION(invalid_value ,"invalid value");
@@ -106,7 +108,8 @@ namespace triton
{ {
class base: public std::exception{}; class base: public std::exception{};
#define TRITON_CREATE_CUBLAS_EXCEPTION(name, msg) class name: public base { public: const char * what() const throw(){ return "CUBLAS: Error- " msg; } } #define TRITON_CREATE_CUBLAS_EXCEPTION(name, msg) \
class name: public base { public: const char * what() const throw() override { return "CUBLAS: Error- " msg; } }
TRITON_CREATE_CUBLAS_EXCEPTION(not_initialized ,"not initialized"); TRITON_CREATE_CUBLAS_EXCEPTION(not_initialized ,"not initialized");
TRITON_CREATE_CUBLAS_EXCEPTION(alloc_failed ,"alloc failed"); TRITON_CREATE_CUBLAS_EXCEPTION(alloc_failed ,"alloc failed");
@@ -124,7 +127,8 @@ namespace triton
namespace cudnn namespace cudnn
{ {
#define TRITON_CREATE_CUDNN_EXCEPTION(name, msg) class name: public std::exception { public: const char * what() const throw(){ return "CUDNN: Error- " msg; } } #define TRITON_CREATE_CUDNN_EXCEPTION(name, msg) \
class name: public std::exception { public: const char * what() const throw() override { return "CUDNN: Error- " msg; } }
TRITON_CREATE_CUDNN_EXCEPTION(not_initialized ,"not initialized"); TRITON_CREATE_CUDNN_EXCEPTION(not_initialized ,"not initialized");
TRITON_CREATE_CUDNN_EXCEPTION(alloc_failed ,"allocation failed"); TRITON_CREATE_CUDNN_EXCEPTION(alloc_failed ,"allocation failed");
@@ -148,7 +152,8 @@ namespace triton
{ {
class base: public std::exception{}; class base: public std::exception{};
#define TRITON_CREATE_HIP_EXCEPTION(name, msg) class name: public base { public:const char * what() const throw(){ return "HIP: Error- " msg; } } #define TRITON_CREATE_HIP_EXCEPTION(name, msg) \
class name: public base { public:const char * what() const throw() override { return "HIP: Error- " msg; } }
TRITON_CREATE_HIP_EXCEPTION(invalid_value ,"invalid value"); TRITON_CREATE_HIP_EXCEPTION(invalid_value ,"invalid value");