Skip to content

Commit

Permalink
Minor code fixes & code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuttari committed Nov 6, 2024
1 parent 6a8f27a commit 3ac1899
Show file tree
Hide file tree
Showing 20 changed files with 12,289 additions and 14,395 deletions.
67 changes: 30 additions & 37 deletions include/public/marco/Modeling/AccessFunctionEmpty.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,53 @@

#include "marco/Modeling/AccessFunctionAffineMap.h"

namespace marco::modeling
{
class AccessFunctionEmpty : public AccessFunctionAffineMap
{
public:
static bool canBeBuilt(
uint64_t numOfDimensions,
llvm::ArrayRef<std::unique_ptr<DimensionAccess>> results);
namespace marco::modeling {
class AccessFunctionEmpty : public AccessFunctionAffineMap {
public:
static bool
canBeBuilt(uint64_t numOfDimensions,
llvm::ArrayRef<std::unique_ptr<DimensionAccess>> results);

static bool canBeBuilt(mlir::AffineMap affineMap);
static bool canBeBuilt(mlir::AffineMap affineMap);

explicit AccessFunctionEmpty(mlir::AffineMap affineMap);
explicit AccessFunctionEmpty(mlir::AffineMap affineMap);

AccessFunctionEmpty(
mlir::MLIRContext* context,
uint64_t numOfDimensions,
llvm::ArrayRef<std::unique_ptr<DimensionAccess>> results);
AccessFunctionEmpty(mlir::MLIRContext *context, uint64_t numOfDimensions,
llvm::ArrayRef<std::unique_ptr<DimensionAccess>> results);

~AccessFunctionEmpty() override;
~AccessFunctionEmpty() override;

[[nodiscard]] std::unique_ptr<AccessFunction> clone() const override;
[[nodiscard]] std::unique_ptr<AccessFunction> clone() const override;

/// @name LLVM-style RTTI methods
/// {
/// @name LLVM-style RTTI methods
/// {

static bool classof(const AccessFunction* obj)
{
return obj->getKind() == Empty;
}
static bool classof(const AccessFunction *obj) {
return obj->getKind() == Empty;
}

/// }
/// }

[[nodiscard]] bool operator==(
const AccessFunction& other) const override;
[[nodiscard]] bool operator==(const AccessFunction &other) const override;

[[nodiscard]] bool operator==(const AccessFunctionEmpty& other) const;
[[nodiscard]] bool operator==(const AccessFunctionEmpty &other) const;

[[nodiscard]] bool operator!=(
const AccessFunction& other) const override;
[[nodiscard]] bool operator!=(const AccessFunction &other) const override;

[[nodiscard]] bool operator!=(const AccessFunctionEmpty& other) const;
[[nodiscard]] bool operator!=(const AccessFunctionEmpty &other) const;

[[nodiscard]] bool isInvertible() const override;
[[nodiscard]] bool isInvertible() const override;

[[nodiscard]] std::unique_ptr<AccessFunction> inverse() const override;
[[nodiscard]] std::unique_ptr<AccessFunction> inverse() const override;

[[nodiscard]] IndexSet map(const Point& point) const override;
[[nodiscard]] IndexSet map(const Point &point) const override;

[[nodiscard]] IndexSet map(const IndexSet& indices) const override;
[[nodiscard]] IndexSet map(const IndexSet &indices) const override;

[[nodiscard]] IndexSet inverseMap(
const IndexSet& accessedIndices,
const IndexSet& parentIndices) const override;
[[nodiscard]] IndexSet
inverseMap(const IndexSet &accessedIndices,
const IndexSet &parentIndices) const override;
};
}
} // namespace marco::modeling

#endif // MARCO_MODELING_ACCESSFUNCTIONEMPTY_H
92 changes: 34 additions & 58 deletions include/public/marco/Modeling/DimensionAccessConstant.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,54 @@

#include "marco/Modeling/DimensionAccess.h"

namespace marco::modeling
{
class DimensionAccessConstant : public DimensionAccess
{
public:
DimensionAccessConstant(mlir::MLIRContext* context, int64_t value);
namespace marco::modeling {
class DimensionAccessConstant : public DimensionAccess {
public:
DimensionAccessConstant(mlir::MLIRContext *context, int64_t value);

DimensionAccessConstant(const DimensionAccessConstant& other);
static bool classof(const DimensionAccess *obj) {
return obj->getKind() == DimensionAccess::Kind::Constant;
}

DimensionAccessConstant(DimensionAccessConstant&& other) noexcept;
[[nodiscard]] std::unique_ptr<DimensionAccess> clone() const override;

~DimensionAccessConstant() override;
[[nodiscard]] bool operator==(const DimensionAccess &other) const override;

DimensionAccessConstant& operator=(const DimensionAccessConstant& other);
[[nodiscard]] bool operator==(const DimensionAccessConstant &other) const;

DimensionAccessConstant& operator=(
DimensionAccessConstant&& other) noexcept;
[[nodiscard]] bool operator!=(const DimensionAccess &other) const override;

friend void swap(
DimensionAccessConstant& first, DimensionAccessConstant& second);
[[nodiscard]] bool operator!=(const DimensionAccessConstant &other) const;

static bool classof(const DimensionAccess* obj)
{
return obj->getKind() == DimensionAccess::Kind::Constant;
}
llvm::raw_ostream &dump(llvm::raw_ostream &os,
const llvm::DenseMap<const IndexSet *, uint64_t>
&iterationSpacesIds) const override;

[[nodiscard]] std::unique_ptr<DimensionAccess> clone() const override;
void collectIterationSpaces(
llvm::DenseSet<const IndexSet *> &iterationSpaces) const override;

[[nodiscard]] bool operator==(
const DimensionAccess& other) const override;
void collectIterationSpaces(
llvm::SmallVectorImpl<const IndexSet *> &iterationSpaces,
llvm::DenseMap<const IndexSet *, llvm::DenseSet<uint64_t>>
&dependentDimensions) const override;

[[nodiscard]] bool operator==(
const DimensionAccessConstant& other) const;
[[nodiscard]] bool isAffine() const override;

[[nodiscard]] bool operator!=(
const DimensionAccess& other) const override;
[[nodiscard]] mlir::AffineExpr getAffineExpr() const override;

[[nodiscard]] bool operator!=(
const DimensionAccessConstant& other) const;
[[nodiscard]] mlir::AffineExpr
getAffineExpr(unsigned int numOfDimensions,
FakeDimensionsMap &fakeDimensionsMap) const override;

llvm::raw_ostream& dump(
llvm::raw_ostream& os,
const llvm::DenseMap<const IndexSet*, uint64_t>& iterationSpacesIds)
const override;
[[nodiscard]] IndexSet map(const Point &point,
llvm::DenseMap<const IndexSet *, Point>
&currentIndexSetsPoint) const override;

void collectIterationSpaces(
llvm::DenseSet<const IndexSet*>& iterationSpaces) const override;
[[nodiscard]] int64_t getValue() const;

void collectIterationSpaces(
llvm::SmallVectorImpl<const IndexSet*>& iterationSpaces,
llvm::DenseMap<
const IndexSet*,
llvm::DenseSet<uint64_t>>& dependentDimensions) const override;

[[nodiscard]] bool isAffine() const override;

[[nodiscard]] mlir::AffineExpr getAffineExpr() const override;

[[nodiscard]] mlir::AffineExpr getAffineExpr(
unsigned int numOfDimensions,
FakeDimensionsMap& fakeDimensionsMap) const override;

[[nodiscard]] IndexSet map(
const Point& point,
llvm::DenseMap<
const IndexSet*, Point>& currentIndexSetsPoint) const override;

[[nodiscard]] int64_t getValue() const;

private:
int64_t value;
};
}
private:
int64_t value;
};
} // namespace marco::modeling

#endif // MARCO_MODELING_DIMENSIONACCESSCONSTANT_H
92 changes: 34 additions & 58 deletions include/public/marco/Modeling/DimensionAccessDimension.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,54 @@

#include "marco/Modeling/DimensionAccess.h"

namespace marco::modeling
{
class DimensionAccessDimension : public DimensionAccess
{
public:
DimensionAccessDimension(mlir::MLIRContext* context, uint64_t dimension);
namespace marco::modeling {
class DimensionAccessDimension : public DimensionAccess {
public:
DimensionAccessDimension(mlir::MLIRContext *context, uint64_t dimension);

DimensionAccessDimension(const DimensionAccessDimension& other);
static bool classof(const DimensionAccess *obj) {
return obj->getKind() == DimensionAccess::Kind::Dimension;
}

DimensionAccessDimension(DimensionAccessDimension&& other) noexcept;
[[nodiscard]] std::unique_ptr<DimensionAccess> clone() const override;

~DimensionAccessDimension() override;
[[nodiscard]] bool operator==(const DimensionAccess &other) const override;

DimensionAccessDimension& operator=(const DimensionAccessDimension& other);
[[nodiscard]] bool operator==(const DimensionAccessDimension &other) const;

DimensionAccessDimension& operator=(
DimensionAccessDimension&& other) noexcept;
[[nodiscard]] bool operator!=(const DimensionAccess &other) const override;

friend void swap(
DimensionAccessDimension& first, DimensionAccessDimension& second);
[[nodiscard]] bool operator!=(const DimensionAccessDimension &other) const;

static bool classof(const DimensionAccess* obj)
{
return obj->getKind() == DimensionAccess::Kind::Dimension;
}
llvm::raw_ostream &dump(llvm::raw_ostream &os,
const llvm::DenseMap<const IndexSet *, uint64_t>
&iterationSpacesIds) const override;

[[nodiscard]] std::unique_ptr<DimensionAccess> clone() const override;
void collectIterationSpaces(
llvm::DenseSet<const IndexSet *> &iterationSpaces) const override;

[[nodiscard]] bool operator==(
const DimensionAccess& other) const override;
void collectIterationSpaces(
llvm::SmallVectorImpl<const IndexSet *> &iterationSpaces,
llvm::DenseMap<const IndexSet *, llvm::DenseSet<uint64_t>>
&dependentDimensions) const override;

[[nodiscard]] bool operator==(
const DimensionAccessDimension& other) const;
[[nodiscard]] bool isAffine() const override;

[[nodiscard]] bool operator!=(
const DimensionAccess& other) const override;
[[nodiscard]] mlir::AffineExpr getAffineExpr() const override;

[[nodiscard]] bool operator!=(
const DimensionAccessDimension& other) const;
[[nodiscard]] mlir::AffineExpr
getAffineExpr(unsigned int numOfDimensions,
FakeDimensionsMap &fakeDimensionsMap) const override;

llvm::raw_ostream& dump(
llvm::raw_ostream& os,
const llvm::DenseMap<const IndexSet*, uint64_t>& iterationSpacesIds)
const override;
[[nodiscard]] IndexSet map(const Point &point,
llvm::DenseMap<const IndexSet *, Point>
&currentIndexSetsPoint) const override;

void collectIterationSpaces(
llvm::DenseSet<const IndexSet*>& iterationSpaces) const override;
[[nodiscard]] uint64_t getDimension() const;

void collectIterationSpaces(
llvm::SmallVectorImpl<const IndexSet*>& iterationSpaces,
llvm::DenseMap<
const IndexSet*,
llvm::DenseSet<uint64_t>>& dependentDimensions) const override;

[[nodiscard]] bool isAffine() const override;

[[nodiscard]] mlir::AffineExpr getAffineExpr() const override;

[[nodiscard]] mlir::AffineExpr getAffineExpr(
unsigned int numOfDimensions,
FakeDimensionsMap& fakeDimensionsMap) const override;

[[nodiscard]] IndexSet map(
const Point& point,
llvm::DenseMap<
const IndexSet*, Point>& currentIndexSetsPoint) const override;

[[nodiscard]] uint64_t getDimension() const;

private:
uint64_t dimension;
};
}
private:
uint64_t dimension;
};
} // namespace marco::modeling

#endif // MARCO_MODELING_DIMENSIONACCESSDIMENSION_H
Loading

0 comments on commit 3ac1899

Please sign in to comment.