Skip to content
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

Fix calling convention and other small bugs #16

Merged
merged 12 commits into from
Oct 15, 2019
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: 5 additions & 5 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Enzyme CI
name: C/C++ CI

on: [push]

Expand All @@ -10,13 +10,13 @@ jobs:
strategy:
fail-fast: false
matrix:
llvm: ["7", "8"]
llvm: ["7"]
build: ["Release", "Debug"] # "RelWithDebInfo"
os: [ubuntu-18.04]

steps:
- name: add llvm
run: sudo apt-get install -y llvm-${{ matrix.llvm }}-dev llvm-${{ matrix.llvm }}-tools
run: sudo apt-get install -y llvm-${{ matrix.llvm }}-dev llvm-${{ matrix.llvm }}-tools clang-${{ matrix.llvm }}
- uses: actions/checkout@v1
with:
fetch-depth: 1
Expand All @@ -28,5 +28,5 @@ jobs:
cmake .. -DLLVM_EXTERNAL_LIT=/usr/lib/llvm-${{ matrix.llvm }}/build/utils/lit/lit.py -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm
- name: make
run: cd enzyme/build && make
- name: make check-enzyme
run: cd enzyme/build && make check-enzyme
- name: make check-enzyme-c
run: cd enzyme/build && make check-enzyme-c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Functional Tests CI
name: Enzyme CI

on: [push]

Expand All @@ -10,13 +10,13 @@ jobs:
strategy:
fail-fast: false
matrix:
llvm: ["7"]
llvm: ["7", "8"]
build: ["Release", "Debug"] # "RelWithDebInfo"
os: [ubuntu-18.04]

steps:
- name: add llvm
run: sudo apt-get install -y llvm-${{ matrix.llvm }}-dev llvm-${{ matrix.llvm }}-tools clang-${{ matrix.llvm }}
run: sudo apt-get install -y llvm-${{ matrix.llvm }}-dev llvm-${{ matrix.llvm }}-tools
- uses: actions/checkout@v1
with:
fetch-depth: 1
Expand All @@ -28,5 +28,5 @@ jobs:
cmake .. -DLLVM_EXTERNAL_LIT=/usr/lib/llvm-${{ matrix.llvm }}/build/utils/lit/lit.py -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm
- name: make
run: cd enzyme/build && make
- name: make check-enzyme-c
run: cd enzyme/build && make check-enzyme-c
- name: make check-enzyme
run: cd enzyme/build && make check-enzyme
2 changes: 2 additions & 0 deletions .github/workflows/julia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
run: |
mkdir build
cd build
cmake --version
ls /home/runner/work/Enzyme/Enzyme/enzyme/Enzyme/
cmake -DLLVM_DIR=../contrib/usr/lib/cmake/llvm -DLLVM_EXTERNAL_LIT=../contrib/usr/tools/lit/lit.py ../enzyme
make -j
- name: "Julia tests"
Expand Down
25 changes: 14 additions & 11 deletions enzyme/Enzyme/ActiveVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"

#include "llvm/Support/raw_ostream.h"

#include "ActiveVariable.h"
#include "Utils.h"
Expand Down Expand Up @@ -57,7 +58,6 @@ bool isIntASecretFloat(Value* val) {
std::function<void(Value*)> trackPointer = [&](Value* v) {
if (seen.find(v) != seen.end()) return;
seen.insert(v);
llvm::errs() << " consider val " << *val << " for v " << * v << "\n";
do {
Type* let = cast<PointerType>(v->getType())->getElementType();
if (let->isFloatingPointTy()) {
Expand Down Expand Up @@ -179,7 +179,6 @@ Type* isIntPointerASecretFloat(Value* val) {
std::function<void(Value*)> trackPointer = [&](Value* v) {
if (seen.find(v) != seen.end()) return;
seen.insert(v);
llvm::errs() << " consider val " << *val << " for v " << * v << "\n";
do {
Type* let = cast<PointerType>(v->getType())->getElementType();
if (let->isFloatingPointTy()) {
Expand Down Expand Up @@ -475,15 +474,19 @@ bool isconstantM(Instruction* inst, SmallPtrSetImpl<Value*> &constants, SmallPtr
return false;
}
}

constants.insert(inst);
constants.insert(constants2.begin(), constants2.end());
constants.insert(constants_tmp.begin(), constants_tmp.end());
//if (directions == 3)
// nonconstant.insert(nonconstant2.begin(), nonconstant2.end());
if (printconst)
llvm::errs() << "constant(" << (int)directions << ") call:" << *inst << "\n";
return true;

//! TODO: Really need an attribute that determines whether a function can access a global (not even necessarily read)
//if (ci->hasFnAttr(Attribute::ReadNone) || ci->hasFnAttr(Attribute::ArgMemOnly))
{
constants.insert(inst);
constants.insert(constants2.begin(), constants2.end());
constants.insert(constants_tmp.begin(), constants_tmp.end());
//if (directions == 3)
// nonconstant.insert(nonconstant2.begin(), nonconstant2.end());
if (printconst)
llvm::errs() << "constant(" << (int)directions << ") call:" << *inst << "\n";
return true;
}
} else {
for(auto& a: inst->operands()) {
if (!isconstantValueM(a, constants2, nonconstant2, retvals, originalInstructions, UP)) {
Expand Down
4 changes: 3 additions & 1 deletion enzyme/Enzyme/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# set(LLVM_LINK_COMPONENTS Core Support)
#endif()

file(GLOB ENZYME_SRC
file(GLOB ENZYME_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cpp"
)

list(APPEND ENZYME_SRC SCEV/ScalarEvolutionExpander.cpp)

message("found enzyme sources " ${ENZYME_SRC})

if (${LLVM_VERSION_MAJOR} LESS 8)
add_llvm_loadable_module( LLVMEnzyme-${LLVM_VERSION_MAJOR}
${ENZYME_SRC}
Expand Down
2 changes: 0 additions & 2 deletions enzyme/Enzyme/Enzyme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils.h"

#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/ScalarEvolution.h"
Expand Down Expand Up @@ -222,7 +221,6 @@ class Enzyme : public FunctionPass {
AU.addRequired<TargetLibraryInfoWrapperPass>();
AU.addRequired<AAResultsWrapperPass>();
AU.addRequired<GlobalsAAWrapperPass>();
AU.addRequiredID(LoopSimplifyID);
//AU.addRequiredID(LCSSAID);

AU.addRequired<LoopInfoWrapperPass>();
Expand Down
Loading