Skip to content

Commit

Permalink
Merge pull request #2237 from SamArch27/oopsla
Browse files Browse the repository at this point in the history
Auto-Scheduler for Soufflé
  • Loading branch information
Bernhard Scholz authored Apr 1, 2022
2 parents 7f1abdc + 84401ed commit 37b159d
Show file tree
Hide file tree
Showing 40 changed files with 2,013 additions and 279 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ set(SOUFFLE_SOURCES
ast/analysis/RecursiveClauses.cpp
ast/analysis/RedundantRelations.cpp
ast/analysis/RelationSchedule.cpp
ast/analysis/UniqueKeys.cpp
ast/analysis/SCCGraph.cpp
ast/analysis/TopologicallySortedSCCGraph.cpp
ast/analysis/typesystem/PolymorphicObjects.cpp
Expand Down Expand Up @@ -96,7 +97,6 @@ set(SOUFFLE_SOURCES
ast/transform/RemoveRedundantRelations.cpp
ast/transform/RemoveRedundantSums.cpp
ast/transform/RemoveRelationCopies.cpp
ast/transform/ReorderLiterals.cpp
ast/transform/ReplaceSingletonVariables.cpp
ast/transform/ResolveAliases.cpp
ast/transform/ResolveAnonymousRecordAliases.cpp
Expand Down
22 changes: 20 additions & 2 deletions src/ast/analysis/ProfileUse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ namespace souffle::ast::analysis {
* Run analysis, i.e., retrieve profile information
*/
void ProfileUseAnalysis::run(const TranslationUnit&) {
std::string filename;
if (Global::config().has("profile-use")) {
std::string filename = Global::config().get("profile-use");
profile::Reader(filename, programRun).processFile();
filename = Global::config().get("profile-use");
} else if (Global::config().has("auto-schedule")) {
filename = Global::config().get("auto-schedule");
}
reader = mk<profile::Reader>(filename, programRun);
reader->processFile();
}

/**
Expand All @@ -59,4 +63,18 @@ std::size_t ProfileUseAnalysis::getRelationSize(const QualifiedName& rel) const
}
}

bool ProfileUseAnalysis::hasAutoSchedulerStats() const {
return reader->hasAutoSchedulerStats();
}

std::size_t ProfileUseAnalysis::getNonRecursiveUniqueKeys(
const std::string& rel, const std::string& attributes, const std::string& constants) const {
return reader->getNonRecursiveCountUniqueKeys(rel, attributes, constants);
}

std::size_t ProfileUseAnalysis::getRecursiveUniqueKeys(
const std::string& rel, const std::string& attributes, const std::string& constants) const {
return reader->getRecursiveCountUniqueKeys(rel, attributes, constants);
}

} // namespace souffle::ast::analysis
11 changes: 11 additions & 0 deletions src/ast/analysis/ProfileUse.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "ast/QualifiedName.h"
#include "ast/TranslationUnit.h"
#include "souffle/profile/ProgramRun.h"
#include "souffle/profile/Reader.h"
#include <cstddef>
#include <iostream>
#include <memory>
Expand Down Expand Up @@ -53,9 +54,19 @@ class ProfileUseAnalysis : public Analysis {
/** Return size of relation in the profile */
std::size_t getRelationSize(const QualifiedName& rel) const;

bool hasAutoSchedulerStats() const;

std::size_t getNonRecursiveUniqueKeys(
const std::string& rel, const std::string& attributes, const std::string& constants) const;

std::size_t getRecursiveUniqueKeys(
const std::string& rel, const std::string& attributes, const std::string& constants) const;

private:
/** performance model of profile run */
std::shared_ptr<profile::ProgramRun> programRun;

Own<profile::Reader> reader = nullptr;
};

} // namespace analysis
Expand Down
Loading

0 comments on commit 37b159d

Please sign in to comment.