Skip to content

Commit

Permalink
feat: upgrade to llvm 17 (#12)
Browse files Browse the repository at this point in the history
* build(deps): update zkllvm to version based on llvm 17

* added tests starting from onnx

* pinned libs/onnx-mlir to latest zkML Patch

---------

Co-authored-by: Daniel Kales <[email protected]>
  • Loading branch information
0xThemis and dkales authored Dec 20, 2023
1 parent f658e7d commit 11e2275
Show file tree
Hide file tree
Showing 207 changed files with 525 additions and 3,953 deletions.
2 changes: 1 addition & 1 deletion libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_subdirectory(crypto3)
add_subdirectory(blueprint)
set(ONNX_MLIR_ENABLE_MHLO OFF)
add_subdirectory(onnx-mlir)
add_subdirectory(zk-ml-dialect)
add_subdirectory(onnx-mlir)
2 changes: 1 addition & 1 deletion libs/onnx-mlir
Submodule onnx-mlir updated 738 files
12 changes: 6 additions & 6 deletions mlir-assigner/include/mlir-assigner/parser/evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace zk_ml_toolchain {
bool PrintCircuitOutput;
nil::blueprint::logger &logger;

void doAffineFor(AffineForOp &op, int64_t from, int64_t to, int64_t step) {
void doAffineFor(affine::AffineForOp &op, int64_t from, int64_t to, int64_t step) {
assert(from < to);
assert(step);
// atm handle only simple loops with one region,block and argument
Expand Down Expand Up @@ -347,7 +347,7 @@ namespace zk_ml_toolchain {
// Print the operation attributes
std::string opName = op->getName().getIdentifier().str();
logger.debug("visiting %s", opName);
if (AffineForOp operation = llvm::dyn_cast<AffineForOp>(op)) {
if (affine::AffineForOp operation = llvm::dyn_cast<affine::AffineForOp>(op)) {
logger.debug("visiting affine for!");
assert(op->getAttrs().size() == 3);
AffineMap fromMap = operation.getLowerBoundMap();
Expand All @@ -364,7 +364,7 @@ namespace zk_ml_toolchain {
// llvm::outs() << "starting for with: " << from << "->" << to << " (step)
// " << step << "\n";
doAffineFor(operation, from, to, step);
} else if (AffineLoadOp operation = llvm::dyn_cast<AffineLoadOp>(op)) {
} else if (affine::AffineLoadOp operation = llvm::dyn_cast<affine::AffineLoadOp>(op)) {
auto memref = frames.back().memrefs.find(mlir::hash_value(operation.getMemref()));
assert(memref != frames.back().memrefs.end());

Expand All @@ -380,7 +380,7 @@ namespace zk_ml_toolchain {
}
auto value = memref->second.get(indicesV);
frames.back().locals[mlir::hash_value(operation.getResult())] = value;
} else if (AffineStoreOp operation = llvm::dyn_cast<AffineStoreOp>(op)) {
} else if (affine::AffineStoreOp operation = llvm::dyn_cast<affine::AffineStoreOp>(op)) {
// affine.store
auto memRefHash = mlir::hash_value(operation.getMemref());
logger.debug("looking for MemRef %x", size_t(memRefHash));
Expand All @@ -402,7 +402,7 @@ namespace zk_ml_toolchain {
// put the element from the memref using index vector
memref->second.put(indicesV, value->second);

} else if (AffineYieldOp operation = llvm::dyn_cast<AffineYieldOp>(op)) {
} else if (affine::AffineYieldOp operation = llvm::dyn_cast<affine::AffineYieldOp>(op)) {
// Affine Yields are Noops for us
} else if (opName == "affine.if") {
logger.debug("visiting affine if!");
Expand Down Expand Up @@ -716,7 +716,7 @@ namespace zk_ml_toolchain {
return;
}

if (llvm::isa<AffineDialect>(dial)) {
if (llvm::isa<affine::AffineDialect>(dial)) {
handleAffineOperation(op);
return;
}
Expand Down
4 changes: 3 additions & 1 deletion mlir-assigner/include/mlir-assigner/parser/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <llvm/Support/Path.h>
#include <llvm/Support/SourceMgr.h>

#include <mlir/Parser/Parser.h>
#include <mlir/IR/BuiltinOps.h>
#include <mlir/IR/MLIRContext.h>
#include <mlir/IR/OwningOpRef.h>
Expand Down Expand Up @@ -64,7 +65,8 @@ namespace nil {
log.set_level(log_level);
detail::PolicyManager::set_policy(kind);

onnx_mlir::registerDialects(context);
// onnx_mlir::registerDialects(context);
onnx_mlir::loadDialects(context);
context.getOrLoadDialect<zkml::ZkMlDialect>();

assignment_ptr = std::make_shared<assignment<ArithmetizationType>>();
Expand Down
122 changes: 0 additions & 122 deletions mlir-assigner/tests/Models/BasicMnist/BasicMnist.mlir

This file was deleted.

3 changes: 0 additions & 3 deletions mlir-assigner/tests/Models/BasicMnist/BasicMnist.res

This file was deleted.

272 changes: 0 additions & 272 deletions mlir-assigner/tests/Models/BasicMnist/DotProductBasicMnist.json

This file was deleted.

118 changes: 0 additions & 118 deletions mlir-assigner/tests/Models/BasicMnist/DotProductBasicMnist.mlir

This file was deleted.

Binary file not shown.
109 changes: 0 additions & 109 deletions mlir-assigner/tests/Models/ConvMnist/UnOptimizedMnist-12.json

This file was deleted.

198 changes: 0 additions & 198 deletions mlir-assigner/tests/Models/ConvMnist/UnOptimizedMnist-12.mlir

This file was deleted.

3 changes: 0 additions & 3 deletions mlir-assigner/tests/Models/ConvMnist/UnOptimizedMnist-12.res

This file was deleted.

222 changes: 0 additions & 222 deletions mlir-assigner/tests/Models/ConvMnist/mnist-12.mlir

This file was deleted.

Binary file not shown.
14 changes: 0 additions & 14 deletions mlir-assigner/tests/Ops/Abs/AbsSimple.mlir

This file was deleted.

1 change: 0 additions & 1 deletion mlir-assigner/tests/Ops/Acos/AcosSimple.json

This file was deleted.

14 changes: 0 additions & 14 deletions mlir-assigner/tests/Ops/Acos/AcosSimple.mlir

This file was deleted.

3 changes: 0 additions & 3 deletions mlir-assigner/tests/Ops/Acos/AcosSimple.res

This file was deleted.

1 change: 0 additions & 1 deletion mlir-assigner/tests/Ops/Acosh/AcoshSimple.json

This file was deleted.

26 changes: 0 additions & 26 deletions mlir-assigner/tests/Ops/Add/AddSimple.json

This file was deleted.

16 changes: 0 additions & 16 deletions mlir-assigner/tests/Ops/Add/AddSimple.mlir

This file was deleted.

3 changes: 0 additions & 3 deletions mlir-assigner/tests/Ops/Add/AddSimple.res

This file was deleted.

1 change: 0 additions & 1 deletion mlir-assigner/tests/Ops/And/AndSimple.json

This file was deleted.

3 changes: 0 additions & 3 deletions mlir-assigner/tests/Ops/And/AndSimple.res

This file was deleted.

14 changes: 0 additions & 14 deletions mlir-assigner/tests/Ops/Ceil/CeilSimple.mlir

This file was deleted.

21 changes: 0 additions & 21 deletions mlir-assigner/tests/Ops/Clip/ClipSimple.mlir

This file was deleted.

Loading

0 comments on commit 11e2275

Please sign in to comment.