Skip to content

[feature] RV integration #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "llvm/lib/rv"]
path = llvm/lib/rv
url = https://github.com/sx-aurora-dev/rv.git
branch = hpce/develop
3 changes: 3 additions & 0 deletions clang/lib/CodeGen/CGStmtOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3300,6 +3300,9 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
} else if (const auto *C = S.getSingleClause<OMPOrderClause>()) {
if (C->getKind() == OMPC_ORDER_concurrent)
CGF.LoopStack.setParallel(/*Enable=*/true);
} else {
// TODO: This may not be legal
CGF.LoopStack.setParallel(/*Enable=*/true);
}
},
[IVSize, IVSigned, Ordered, IL, LB, UB, ST, StaticChunkedOne, Chunk,
Expand Down
2 changes: 2 additions & 0 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,8 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
# (this is a variable that CrossCompile sets on recursive invocations)
endif()

include_directories("${CMAKE_SOURCE_DIR}/lib/rv/include")

if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
# special hack for Solaris to handle crazy system sys/regset.h
include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/IR/VPBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class VPBuilder {
Value& CreateContiguousLoad(Type *ReturnTy, Value & Pointer, MaybeAlign Alignment);
Value& CreateScatter(Value & Val, Value & PointerVec, MaybeAlign Alignment);
Value& CreateGather(Type *ReturnTy, Value & PointerVec, MaybeAlign Alignment);
Value &createSelect(Value &OnTrue, Value &OnFalse, Value &Mask, Value &Pivot,
Twine Name = "");
};

} // namespace llvm
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ add_subdirectory(Passes)
add_subdirectory(TextAPI)
add_subdirectory(ToolDrivers)
add_subdirectory(XRay)
add_subdirectory(rv)

if (LLVM_INCLUDE_TESTS)
add_subdirectory(Testing)
endif()
Expand Down
9 changes: 9 additions & 0 deletions llvm/lib/IR/VPBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,13 @@ Value *VPBuilder::CreateVectorShift(Value *SrcVal, Value *Amount, Twine Name) {
Name);
}

Value &VPBuilder::createSelect(Value &OnTrue, Value &OnFalse, Value &Mask,
Value &Pivot, Twine Name) {
auto D = VPIntrinsic::getDeclarationForParams(
&getModule(), Intrinsic::vp_select, OnTrue.getType(),
{&OnTrue, &OnFalse, &Mask, &Pivot});
return *Builder.CreateCall(
D, {&OnTrue, &OnFalse, &Mask, &Pivot, &RequestEVL()}, Name);
}

} // namespace llvm
1 change: 1 addition & 0 deletions llvm/lib/Passes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ add_llvm_component_library(LLVMPasses
TransformUtils
Vectorize
Instrumentation
RV
)
3 changes: 3 additions & 0 deletions llvm/lib/Passes/PassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@
#include "llvm/Transforms/Vectorize/SLPVectorizer.h"
#include "llvm/Transforms/Vectorize/VectorCombine.h"

#include "rv/registerPasses.h"

using namespace llvm;

static const Regex DefaultAliasRegex(
Expand Down Expand Up @@ -413,6 +415,7 @@ PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
#include "PassRegistry.def"
}
rv::addConfiguredRVPasses(*this);
}

void PassBuilder::registerModuleAnalyses(ModuleAnalysisManager &MAM) {
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/rv
Submodule rv added at da1bb9