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

ZIR-280: Keccak2 InitCycle is deterministic 🎉 #115

Merged
merged 11 commits into from
Dec 17, 2024
10 changes: 10 additions & 0 deletions zirgen/Conversions/Typing/ZhlComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,16 @@ Zhlt::ComponentOp LoweringImpl::gen(ComponentOp component,
auto ctor = builder.create<Zhlt::ComponentOp>(
loc, mangledName, valueType, constructArgsTypes, layoutType);
ctor.getBody().takeBody(body);

for (NamedAttribute attr : component->getDiscardableAttrs()) {
StringRef name = attr.getName();
if (name == "function" || name == "argument" || name == "generic" || name == "picus") {
ctor->setAttr(name, attr.getValue());
} else {
ctor->emitError() << "unknown attribute `" << name << "`";
}
}

return ctor;
}

Expand Down
4 changes: 0 additions & 4 deletions zirgen/Dialect/ZHLT/IR/Dialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ class ZhltInlinerInterface : public DialectInlinerInterface {
using DialectInlinerInterface::DialectInlinerInterface;

bool isLegalToInline(Operation* call, Operation* callable, bool wouldBeCloned) const final {
if (isa<ComponentOp>(callable))
// Only inline aspects that have been generated for components, not for the original
// components.
return false;
return isa<FunctionOpInterface>(callable);
}

Expand Down
2 changes: 1 addition & 1 deletion zirgen/Dialect/ZHLT/IR/TypeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ std::string mangledTypeName(StringRef componentName, llvm::ArrayRef<Attribute> t
} else if (auto intAttr = dyn_cast<PolynomialAttr>(typeArg)) {
stream << intAttr[0];
} else if (auto intAttr = dyn_cast<IntegerAttr>(typeArg)) {
stream << intAttr;
stream << intAttr.getUInt();
} else {
llvm::errs() << "Mangling type " << typeArg << " not implemented\n";
assert(false && "not implemented");
Expand Down
18 changes: 18 additions & 0 deletions zirgen/compiler/picus/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package(
default_visibility = ["//visibility:public"],
)

cc_library(
name = "picus",
srcs = [
"picus.cpp",
],
hdrs = [
"picus.h",
],
deps = [
"//zirgen/Dialect/ZHLT/IR",
"//zirgen/Dialect/ZStruct/IR",
"//zirgen/dsl/passes:passes",
],
)
Loading
Loading