Skip to content
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
9 changes: 9 additions & 0 deletions compiler/acir/include/acir/CodeGen/QueueGraphPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ struct QueueWriterArbitrationPlan {
bool operator==(const QueueWriterArbitrationPlan &) const = default;
};

struct SlotReleaseEffectPlan {
std::string slot;
std::string when;

bool operator==(const SlotReleaseEffectPlan &) const = default;
};

struct QueueBlockPlan {
std::string kind;
std::string name;
Expand Down Expand Up @@ -227,6 +234,7 @@ struct QueueBlockPlan {
std::string guard;
std::vector<StateWritePlan> stateWrites;
std::vector<StateReservationPlan> stateReservations;
std::vector<SlotReleaseEffectPlan> slotReleases;
std::vector<OutputPresencePlan> outputPresence;
std::vector<QueueRuleResourcePlan> activationSources;
std::vector<QueueRuleResourcePlan> transactionResources;
Expand Down Expand Up @@ -399,6 +407,7 @@ enum class QueueActivationNodeKind {
Queue,
Block,
Table,
Slot,
};

struct QueueActivationNodePlan {
Expand Down
4 changes: 3 additions & 1 deletion compiler/acir/include/acir/Dialect/ACIR/ACIRAttributes.td
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ def ACIR_ActivationResourceKind_InputQueue
def ACIR_ActivationResourceKind_OutputQueue
: I32EnumAttrCase<"OutputQueue", 1, "output_queue">;
def ACIR_ActivationResourceKind_State : I32EnumAttrCase<"State", 2, "state">;
def ACIR_ActivationResourceKind_Slot : I32EnumAttrCase<"Slot", 3, "slot">;
def ACIR_ActivationResourceKind
: I32EnumAttr<"ActivationResourceKind",
"typed rule activation/transaction resource kind",
[ACIR_ActivationResourceKind_InputQueue,
ACIR_ActivationResourceKind_OutputQueue,
ACIR_ActivationResourceKind_State]> {
ACIR_ActivationResourceKind_State,
ACIR_ActivationResourceKind_Slot]> {
let genSpecializedAttr = 0;
let cppNamespace = "::acir::ac";
}
Expand Down
14 changes: 12 additions & 2 deletions compiler/acir/include/acir/Dialect/ACIR/ACIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,14 @@ def ACIR_SlotReleaseOp : ACIR_Op<"slot.release", [
let assemblyFormat = "$slot `when` $when attr-dict";
}

def ACIR_SlotProposeReleaseOp : ACIR_Op<"slot.propose_release", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins FlatSymbolRefAttr:$slot, ACIR_VarType:$when);
let hasVerifier = 1;
let assemblyFormat = "$slot `when` $when attr-dict `:` qualified(type($when))";
}

def ACIR_SlotYieldOp : ACIR_Op<"slot.yield", [Pure, Terminator]> {
let arguments = (ins ACIR_VarType:$value);
let assemblyFormat = "$value attr-dict `:` qualified(type($value))";
Expand Down Expand Up @@ -1060,7 +1068,9 @@ def ACIR_FeedbackYieldOp : ACIR_Op<"feedback.yield", [
}];
}

def ACIR_ScopeOp : ACIR_Op<"scope", [SingleBlock, RecursiveMemoryEffects]> {
def ACIR_ScopeOp : ACIR_Op<"scope", [
SymbolTable, SingleBlock, RecursiveMemoryEffects
]> {
let arguments = (ins SymbolNameAttr:$sym_name,
Variadic<ACIR_QueueType>:$inputs);
let results = (outs Variadic<ACIR_QueueType>:$outputs);
Expand Down Expand Up @@ -1227,7 +1237,7 @@ def ACIR_SystemOp : ACIR_Op<"system", [Symbol]> {
}

def ACIR_ModuleOp : ACIR_Op<"module", [
Symbol, FunctionOpInterface, IsolatedFromAbove, SingleBlock,
Symbol, SymbolTable, FunctionOpInterface, IsolatedFromAbove, SingleBlock,
RegionKindInterface, HasOnlyGraphRegion
]> {
let arguments = (ins SymbolNameAttr:$sym_name,
Expand Down
7 changes: 7 additions & 0 deletions compiler/acir/lib/Analysis/VariableAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,13 @@ llvm::SmallVector<std::string> completeStateFields(Operation *anchor,
return {"$entry"};
Operation *declaration =
SymbolTable::lookupNearestSymbolFrom(anchor, structure.getName());
if (!declaration) {
Operation *root = anchor;
while (root->getParentOp())
root = root->getParentOp();
if (root->hasTrait<OpTrait::SymbolTable>())
declaration = SymbolTable::lookupSymbolIn(root, structure.getName());
}
auto fields = declaration ? declaration->getAttrOfType<ArrayAttr>("fields")
: ArrayAttr();
llvm::SmallVector<std::string> result;
Expand Down
Loading