Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 7939957fe65cd602197fcb944182452d4e0a0853
Author: Captain Jack Sparrow <[email protected]>
Date:   Sat Jan 14 05:36:29 2023 +0000

    Merged PR 3027: Hack required to use Array as output element argument (Dimension)

commit e4da98835c7dae09d5a37432659733bb2de0a6b2
Author: Captain Jack Sparrow <[email protected]>
Date:   Fri Jan 13 21:37:24 2023 +0000

    Merged PR 3025: Add arg name and size string required for hat metadata

    Add arg name and size string required for hat metadata

commit 83a75cee0acda133fb2a9f397fc1fcc93037f872
Author: Denny Sun <[email protected]>
Date:   Thu Jan 12 22:41:09 2023 +0000

    Merged PR 3017: Output array supports gather function

    Add the dsl test for gather function.
  • Loading branch information
Lisa Ong committed Jan 16, 2023
1 parent 5f5de21 commit 4e60e4a
Show file tree
Hide file tree
Showing 12 changed files with 356 additions and 178 deletions.
104 changes: 30 additions & 74 deletions accera/hat/include/HATEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,41 +277,16 @@ class Parameter : public TOMLSerializable
public:
Parameter() = delete; // Construct via subclasses

Parameter& Name(const std::string& name)
{
_name = name;
return *this;
}
std::string Name() const { return _name; }

Parameter& Description(const std::string& description)
{
_description = description;
return *this;
}
std::string Description() const { return _description; }

LogicalParamType LogicalType() const { return _logicalType; }

Parameter& DeclaredType(const std::string& declaredType)
{
_declaredType = declaredType;
return *this;
}
std::string DeclaredType() const { return _declaredType; }

Parameter& ElementType(const std::string& elementType)
{
_elementType = elementType;
return *this;
}
std::string ElementType() const { return _elementType; }

Parameter& Usage(const UsageType& usage)
{
_usage = usage;
return *this;
}
UsageType Usage() const { return _usage; }

virtual toml::table Serialize() const
Expand All @@ -320,8 +295,14 @@ class Parameter : public TOMLSerializable
}

protected:
Parameter(const LogicalParamType& logicalType) :
_logicalType(logicalType) {}
Parameter(const LogicalParamType& logicalType, const std::string& name, const std::string& description, const UsageType usage, const std::string& declaredType, const std::string& elementType) :
_logicalType{ logicalType },
_name{ name },
_description{ description },
_usage{ usage },
_declaredType{ declaredType },
_elementType{ elementType }
{}

toml::table SerializeCommonParameters() const
{
Expand All @@ -338,39 +319,27 @@ class Parameter : public TOMLSerializable
}

private:
LogicalParamType _logicalType;
std::string _name;
std::string _description;
LogicalParamType _logicalType;
UsageType _usage;
std::string _declaredType;
std::string _elementType;
UsageType _usage;
};

class AffineArrayParameter : public Parameter
{
public:
AffineArrayParameter() :
Parameter(LogicalParamType::AffineArray) {}
AffineArrayParameter(const std::string& name, const std::string& description, const UsageType usage, const std::string& declaredType, const std::string& elementType, const std::vector<size_t>& shape, const std::vector<size_t>& affineMap, size_t affineOffset) :
Parameter(LogicalParamType::AffineArray, name, description, usage, declaredType, elementType),
_shape{ shape },
_affineMap{ affineMap },
_affineOffset{ affineOffset } {}

AffineArrayParameter& Shape(const std::vector<size_t>& shape)
{
_shape = shape;
return *this;
}
std::vector<size_t> Shape() const { return _shape; }

AffineArrayParameter& AffineMap(const std::vector<size_t>& affineMap)
{
_affineMap = affineMap;
return *this;
}
std::vector<size_t> AffineMap() const { return _affineMap; }

AffineArrayParameter& AffineOffset(size_t affineOffset)
{
_affineOffset = affineOffset;
return *this;
}
size_t AffineOffset() const { return _affineOffset; }

toml::table Serialize() const
Expand Down Expand Up @@ -401,14 +370,10 @@ class AffineArrayParameter : public Parameter
class RuntimeArrayParameter : public Parameter
{
public:
RuntimeArrayParameter() :
Parameter(LogicalParamType::RuntimeArray) {}
RuntimeArrayParameter(const std::string& name, const std::string& description, const UsageType usage, const std::string& declaredType, const std::string& elementType, const std::string& size) :
Parameter(LogicalParamType::RuntimeArray, name, description, usage, declaredType, elementType),
_size{ size } {}

RuntimeArrayParameter& Size(const std::string& size)
{
_size = size;
return *this;
}
std::string Size() const { return _size; }

toml::table Serialize() const
Expand All @@ -425,44 +390,35 @@ class RuntimeArrayParameter : public Parameter
class ElementParameter : public Parameter
{
public:
ElementParameter() :
Parameter(LogicalParamType::Element) {}
ElementParameter(const std::string& name, const std::string& description, const UsageType usage, const std::string& declaredType, const std::string& elementType) :
Parameter(LogicalParamType::Element, name, description, usage,
declaredType + (usage != UsageType::Input ? "*" : ""), // Make it a pointer type when not used as input
elementType)
{}
};

class VoidParameter : public Parameter
{
public:
VoidParameter() :
Parameter(LogicalParamType::Void)
VoidParameter(const std::string& name, const std::string& description, const UsageType usage) :
Parameter(LogicalParamType::Void, name, description, usage, "void", "void")
{
DeclaredType("void");
ElementType("void");
}
};

class Function : public TOMLSerializable
, public AuxiliaryExtensible<Function>
{
public:
Function& Name(const std::string& name)
{
_name = name;
return *this;
}
Function(const std::string& name, const std::string& description, const CallingConventionType callingConvention) :
_name{ name },
_description{ description },
_callingConvention{ callingConvention } {}

std::string Name() const { return _name; }

Function& Description(const std::string& description)
{
_description = description;
return *this;
}
std::string Description() const { return _description; }

Function& CallingConvention(const CallingConventionType& callingConvention)
{
_callingConvention = callingConvention;
return *this;
}
CallingConventionType CallingConvention() const { return _callingConvention; }

Function& AddArgument(std::unique_ptr<Parameter>&& argument)
Expand Down
2 changes: 2 additions & 0 deletions accera/ir/include/value/ValueFuncOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class ValueFuncOp : public mlir::Op<ValueFuncOp, mlir::OpTrait::SymbolTable, mli
static StringRef getGPULaunchAttrName() { return "gpu_launch"; }
static StringRef getArgumentsSymbolAttrName() { return "args_symbol"; }
static StringRef getArgumentsSymbolName() { return "args_symbol_name"; }
static StringRef getArgumentsNameAttrName() { return "args_name"; }
static StringRef getArgumentsSizeAttrName() { return "args_size"; }

mlir::StringAttr sym_nameAttr()
{
Expand Down
Loading

0 comments on commit 4e60e4a

Please sign in to comment.