这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4f4eab5
enable apple silicon builds
Oct 15, 2023
549a6a7
restrict Apple Silicon builds to Python3.9+
Oct 15, 2023
72a907f
hw matrix setup
Oct 15, 2023
509406e
print status
Oct 15, 2023
1a096f4
matrix magic
Oct 15, 2023
7b2239b
yaml fix
Oct 15, 2023
c63d3db
test
LeonhardFS Oct 16, 2023
d2861b7
test
LeonhardFS Oct 16, 2023
ab572b8
use macos12 for delocate
LeonhardFS Oct 16, 2023
2f34623
fix
LeonhardFS Oct 16, 2023
10d6c87
Merge branch 'master' into ls-apple-silicon
Oct 22, 2023
b7ba825
Merge branch 'ls-apple-silicon' of github.com:LeonhardFS/tuplex-publi…
Oct 22, 2023
3b07d84
update scripts for arm64 wheels
Oct 24, 2023
d981cc1
experimental transitioning to vcpkg
Oct 24, 2023
1b4b344
llvm 17 can be added
Oct 24, 2023
3496cee
vcpkg support step by step
Oct 25, 2023
15c26f5
wip llvm17 compatibility, remove typed pointers
Oct 25, 2023
28a65a0
remove old functions
Oct 25, 2023
1318a6f
merge in master
Oct 25, 2023
00d56e0
llvm17 fixes, remove old code
Oct 26, 2023
767b311
fixes
Oct 26, 2023
19662ab
more API fixes for llvm17
Oct 27, 2023
13ca03a
more fixing
Oct 27, 2023
273b1ae
compile now works, need to link with llvm libs
Oct 27, 2023
728346b
llvm and cmake tune
Oct 27, 2023
a3b9586
linking and warnings
Oct 27, 2023
5af6370
everything builds now, but tests fail
Oct 27, 2023
22fd6d9
fixes and export symbols in runtime shared object
Nov 2, 2023
356d1a1
compile fixes, change lllvm version to 15 to have typed pointers
Nov 2, 2023
1dd7da8
another fix
Nov 3, 2023
f73d326
update address resolution for llvm17
Nov 3, 2023
9e4d108
update github pipelines to rely on vcpkg for this build
LeonhardFS Nov 4, 2023
6475ccb
protobuf change
Nov 18, 2023
4d24852
merge in master
Nov 19, 2023
db36068
llvm17 fixes/updates
Nov 22, 2023
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
37 changes: 25 additions & 12 deletions tuplex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# (c) 2017 Leonhard Spiegelberg
# (c) 2017-2023 Leonhard Spiegelberg
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

# top-level language specification
# enable c++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "Using language version: C++${CMAKE_CXX_STANDARD}")

# add cmake modules from cmake folder
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")

# Tuplex build options:
# =====================

Expand Down Expand Up @@ -36,6 +45,16 @@ if(CMAKE_GENERATOR STREQUAL "Ninja")
message(STATUS "Using ninja generator, if fails use -w dupbuild=err")
endif()

# The -fvisibility=hidden option only works for static builds.
if (NOT BUILD_SHARED_LIBS)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
else()
if (CMAKE_CXX_VISIBILITY_PRESET STREQUAL "hidden")
message(FATAL_ERROR "CMAKE_CXX_VISIBILITY_PRESET=hidden is incompatible \
with BUILD_SHARED_LIBS.")
endif()
endif()

# detect MacOS Version because at least 10.13 is required when building with AWS SDK
if(APPLE)
execute_process(COMMAND bash -c "sw_vers | grep -Eo '([0-9]{1,}\\.)+[0-9]{1,}' | head -1" OUTPUT_VARIABLE MACOSX_VERSION_STRING OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down Expand Up @@ -73,14 +92,6 @@ endif()
# uncomment to get verbose cmake output
# set(CMAKE_VERBOSE_MAKEFILE ON)

# top-level language specification
# enable c++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "Using language version: C++${CMAKE_CXX_STANDARD}")

# add cmake modules from cmake folder
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
message(STATUS "additional cmake module path is ${CMAKE_MODULE_PATH}")
include("${CMAKE_SOURCE_DIR}/cmake/ucm.cmake") #handy package to manipulate compiler flags
include("${CMAKE_SOURCE_DIR}/cmake/CPM.cmake") # package manager from https://github.com/cpm-cmake/CPM.cmake
Expand Down Expand Up @@ -989,18 +1000,20 @@ find_package(Curses REQUIRED)
# add subdirs here...
add_subdirectory(io) # <-- make sure to call this first, because it changes parent scope with io dependencies
add_subdirectory(utils)
add_subdirectory(test)
add_subdirectory(codegen)
add_subdirectory(core)
add_subdirectory(python)
add_subdirectory(runtime)
add_subdirectory(adapters)

# can only build aws lambda on linux platform
if(LINUX AND BUILD_WITH_AWS)
# removed AWS lambda implementation, can be found on separate branch
add_subdirectory(awslambda)
add_subdirectory(awslambda)
endif()
# call test dir last to get vars from before
add_subdirectory(test)



###########################################################################
# (7) Additional flags
Expand Down
3 changes: 2 additions & 1 deletion tuplex/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ endif()
MESSAGE(STATUS "Found LLVM include dirs at: " ${LLVM_INCLUDE_DIRS})
MESSAGE(STATUS "LLVM library dir: ${LLVM_LIBRARY_DIRS}")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LLVM_LIBRARY_DIRS})

llvm_map_components_to_libnames(llvm_libs ${LLVM_REQUIRED_COMPONENTS})
set(LLVM_LIBRARIES "${llvm_libs}")
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})

Expand Down
61 changes: 10 additions & 51 deletions tuplex/codegen/include/CodegenHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,25 +405,6 @@ namespace tuplex {
return get_or_throw().CreateConstGEP2_64(Ty, Ptr, Idx0, Idx1, Name);
}

inline llvm::Value *CreateConstInBoundsGEP2_64(llvm::Value *Ptr, uint64_t Idx0,
uint64_t Idx1, const std::string &Name = "") const {
using namespace llvm;

// cf. https://github.com/llvm/llvm-project/commit/544fa425c98d60042214bd78ee90abf0a46fa2ff
assert(Ptr->getType());
llvm::Type *Ty = nullptr;

// print types
auto ptrType = cast<PointerType>(Ptr->getType()->getScalarType());
Ty = ptrType->getPointerElementType();

#if LLVM_VERSION_MAJOR >= 13
// match
assert(cast<PointerType>(Ptr->getType()->getScalarType())->isOpaqueOrPointeeTypeMatches(Ty));
#endif
return CreateConstInBoundsGEP2_64(Ptr, Ty, Idx0, Idx1, Name);
}

inline llvm::Value *CreatePtrToInt(llvm::Value *V, llvm::Type *DestTy,
const std::string &Name = "") { return get_or_throw().CreatePtrToInt(V, DestTy, Name); }

Expand All @@ -433,7 +414,7 @@ namespace tuplex {

inline llvm::CallInst *CreateCall(llvm::FunctionType *FTy, llvm::Value *Callee,

#if (LLVM_VERSION_MAJOR >= 10)
#if (LLVM_VERSION_MAJOR >= 16)
llvm::ArrayRef<llvm::Value *> Args = std::nullopt,
#else
llvm::ArrayRef<llvm::Value *> Args = {},
Expand All @@ -445,7 +426,7 @@ namespace tuplex {
}

inline llvm::CallInst* CreateCall(llvm::Value* func_value,
#if (LLVM_VERSION_MAJOR >= 10)
#if (LLVM_VERSION_MAJOR >= 16)
llvm::ArrayRef<llvm::Value *> Args = std::nullopt,
#else
llvm::ArrayRef<llvm::Value *> Args = {},
Expand All @@ -459,7 +440,7 @@ namespace tuplex {
}

inline llvm::CallInst* CreateCall(llvm::Function* func,
#if (LLVM_VERSION_MAJOR >= 10)
#if (LLVM_VERSION_MAJOR >= 16)
llvm::ArrayRef<llvm::Value *> Args = std::nullopt,
#else
llvm::ArrayRef<llvm::Value *> Args = {},
Expand All @@ -470,7 +451,7 @@ namespace tuplex {
}

inline llvm::CallInst *CreateCall(llvm::FunctionCallee Callee,
#if (LLVM_VERSION_MAJOR >= 10)
#if (LLVM_VERSION_MAJOR >= 16)
llvm::ArrayRef<llvm::Value *> Args = std::nullopt,
#else
llvm::ArrayRef<llvm::Value *> Args = {},
Expand Down Expand Up @@ -508,19 +489,6 @@ namespace tuplex {
#endif
}

inline llvm::LoadInst *CreateLoad(llvm::Value *Ptr, const std::string& Name ="") const {
throw std::runtime_error("need to replace this call with typed call.");
assert(Ptr->getType()->getPointerElementType());
return CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}

inline llvm::Value *CreateGEP(llvm::Value *Ptr, llvm::ArrayRef<llvm::Value *> IdxList,
const std::string &Name = "") const {
assert(Ptr->getType()->getScalarType()->getPointerElementType());
// this is deprecated
return CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(),
Ptr, IdxList, Name);
}

inline llvm::Value* CreateInBoundsGEP(llvm::Value* Ptr, llvm::Type* pointee_type, llvm::Value* Idx) {
return get_or_throw().CreateInBoundsGEP(pointee_type, Ptr, {Idx});
Expand Down Expand Up @@ -647,15 +615,6 @@ namespace tuplex {
#endif
}

inline llvm::Value *CreatePtrDiff(llvm::Value *LHS, llvm::Value *RHS,
const std::string &Name = "") const {
assert(LHS->getType() == RHS->getType() && LHS->getType()->isPointerTy());
llvm::Type *ElemTy = LHS->getType()->getPointerElementType();
assert(ElemTy);
return CreatePtrDiff(ElemTy, LHS, RHS, Name);
}


llvm::Value *CreateRetVoid() const {
return get_or_throw().CreateRetVoid();
}
Expand Down Expand Up @@ -805,13 +764,13 @@ namespace tuplex {
ctorBuilder.SetInsertPoint(&inst);
}
// disable here clang/gcc warning just for this - it's a limitation of how ctorbuilder is architected.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreturn-local-addr"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-local-addr"
// #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wreturn-local-addr"
// #pragma GCC diagnostic push
// #pragma GCC diagnostic ignored "-Wreturn-local-addr"
return std::move(ctorBuilder);
#pragma GCC diagnostic pop
#pragma clang diagnostic pop
// #pragma GCC diagnostic pop
// #pragma clang diagnostic pop
}

// in order to serialize/deserialize data properly and deal with
Expand Down
69 changes: 5 additions & 64 deletions tuplex/codegen/include/IteratorContextProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,70 +127,6 @@ namespace tuplex {
llvm::Value *iterator,
const std::shared_ptr<IteratorInfo> &iteratorInfo);

/*!
* Update index for a zip iterator in preparing for the getIteratorNextElement call by calling updateIteratorIndex on each argument.
* If any argument is exhausted, return true and stop calling updateIteratorIndex on rest of the arguments.
* Only return false if none of the argument iterators is exhausted.
* @param builder
* @param iterator
* @param iteratorInfo
* @return true if iterator is exhausted (getIteratorNextElement should not get called later), otherwise false
*/
llvm::Value *updateZipIndex(const codegen::IRBuilder& builder,
llvm::Value *iterator,
const std::shared_ptr<IteratorInfo> &iteratorInfo);

/*!
* Generate the next element of a zip iterator.
* Only to be called after calling updateIteratorIndex.
* @param builder
* @param yieldType
* @param iterator
* @param iteratorInfo
* @return tuple element of yieldType
*/
SerializableValue getZipNextElement(const codegen::IRBuilder& builder,
const python::Type &yieldType,
llvm::Value *iterator,
const std::shared_ptr<IteratorInfo> &iteratorInfo);

/*!
* Generate the next element of a enumerate iterator.
* Only to be called after calling updateIteratorIndex.
* @param builder
* @param iterator
* @param iteratorInfo
* @return true if iterator is exhausted (getIteratorNextElement should not get called later), otherwise false
*/
llvm::Value *updateEnumerateIndex(const codegen::IRBuilder& builder,
llvm::Value *iterator,
const std::shared_ptr<IteratorInfo> &iteratorInfo);

/*!
* Generate the next element of a enumerate iterator.
* Only to be called after calling updateIteratorIndex.
* @param builder
* @param yieldType
* @param iterator
* @param iteratorInfo
* @return tuple element of yieldType
*/
SerializableValue getEnumerateNextElement(const codegen::IRBuilder& builder,
const python::Type &yieldType,
llvm::Value *iterator,
const std::shared_ptr<IteratorInfo> &iteratorInfo);

/*!
* Increment index field of a list/string/tuple iterator by offset.
* Increment index field of a range iterator by step * offset.
* Decrement index field of any reverseiterator by offset.
* For zip and enumerate, will use recursive calls on their arguments until a list/string/tuple iterator or a reverseiterator is reached.
* @param builder
* @param iterator
* @param iteratorInfo
* @param offset can be negative
*/
void incrementIteratorIndex(const codegen::IRBuilder& builder, llvm::Value *iterator, const std::shared_ptr<IteratorInfo> &iteratorInfo, int offset);
};

/*!
Expand All @@ -200,6 +136,11 @@ namespace tuplex {
* @return corresponding llvm::Type
*/
extern llvm::Type* createIteratorContextTypeFromIteratorInfo(LLVMEnvironment& env, const IteratorInfo& iteratorInfo);

extern void increment_iterator_index(LLVMEnvironment& env, const codegen::IRBuilder& builder,
llvm::Value *iterator,
const std::shared_ptr<IteratorInfo> &iteratorInfo,
int32_t offset);
}

namespace codegen {
Expand Down
2 changes: 1 addition & 1 deletion tuplex/codegen/include/LLVMEnvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace llvm {
CallInst *CI = CallInst::Create(Callee, Ops, Name);
if (FMFSource)
CI->copyFastMathFlags(FMFSource);
#if (LLVM_VERSION_MAJOR <= 14)
#if (LLVM_VERSION_MAJOR <= 15)
builder.GetInsertBlock()->getInstList().insert(builder.GetInsertPoint(), CI);
#else
CI->insertInto(builder.GetInsertBlock(), builder.GetInsertBlock()->begin());
Expand Down
Loading