forked from onnx/onnx-mlir
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into splitesequence
- Loading branch information
Showing
55 changed files
with
949 additions
and
855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
numpy~=1.22.2 | ||
pillow~=10.2.0 | ||
torch~=2.0.0 | ||
torchvision~=0.15.1 | ||
pillow~=10.3.0 | ||
torch~=2.5.0 | ||
torchvision~=0.20.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Accelerators/NNPA/Compiler/ZHighDisposableGarbageCollector.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
//===---------------- ZHighDisposableGarbageCollector.cpp -----------------===// | ||
// | ||
// Garbage collects DisposableElementsAttr attributes. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "src/Accelerators/NNPA/Compiler/ZHighDisposableGarbageCollector.hpp" | ||
#include "src/Accelerators/NNPA/Dialect/ZHigh/ZHighOps.hpp" | ||
#include "src/Dialect/ONNX/ElementsAttr/DisposablePool.hpp" | ||
#include "src/Dialect/ONNX/ONNXDialect.hpp" | ||
#include "src/Dialect/ONNX/ONNXOps.hpp" | ||
|
||
#include "mlir/IR/BuiltinOps.h" | ||
|
||
using namespace mlir; | ||
|
||
namespace onnx_mlir { | ||
namespace zhigh { | ||
|
||
ZHighDisposableGarbageCollector::ZHighDisposableGarbageCollector( | ||
MLIRContext *context) | ||
: disposablePool(*DisposablePool::get<ONNXDialect>(context)) {} | ||
|
||
ZHighDisposableGarbageCollector::~ZHighDisposableGarbageCollector() {} | ||
|
||
void ZHighDisposableGarbageCollector::runAfterPass(Pass *pass, Operation *op) { | ||
if (!disposablePool.isActive()) | ||
return; | ||
ModuleOp moduleOp = mlir::dyn_cast<ModuleOp>(op); | ||
if (!moduleOp) | ||
return; | ||
disposablePool.garbageCollectUnreachable( | ||
moduleOp, {{ONNXConstantOp::getOperationName(), "value"}, | ||
{ONNXConstantOfShapeOp::getOperationName(), "value"}, | ||
{ZHighStickifiedConstantOp::getOperationName(), "value"}}); | ||
} | ||
|
||
} // namespace zhigh | ||
} // namespace onnx_mlir |
37 changes: 37 additions & 0 deletions
37
src/Accelerators/NNPA/Compiler/ZHighDisposableGarbageCollector.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
//===---------------- ZHighDisposableGarbageCollector.hpp -----------------===// | ||
// | ||
// Garbage collects DisposableElementsAttr attributes. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef ONNX_MLIR_ZHIGH_GARBAGE_COLLECTOR_H | ||
#define ONNX_MLIR_ZHIGH_GARBAGE_COLLECTOR_H | ||
|
||
#include "mlir/Pass/PassInstrumentation.h" | ||
|
||
namespace mlir { | ||
class MLIRContext; | ||
} | ||
|
||
namespace onnx_mlir { | ||
class DisposablePool; | ||
|
||
namespace zhigh { | ||
|
||
struct ZHighDisposableGarbageCollector : public mlir::PassInstrumentation { | ||
ZHighDisposableGarbageCollector(mlir::MLIRContext *context); | ||
~ZHighDisposableGarbageCollector() override; | ||
|
||
void runAfterPass(mlir::Pass *pass, mlir::Operation *op) override; | ||
|
||
private: | ||
DisposablePool &disposablePool; | ||
}; | ||
|
||
} // namespace zhigh | ||
} // namespace onnx_mlir | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.