Skip to content

Commit

Permalink
Add ONNX operator version as trait of dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
cferry-AMD authored Jun 13, 2024
1 parent 4818661 commit 67cb3a6
Show file tree
Hide file tree
Showing 5 changed files with 279 additions and 240 deletions.
5 changes: 5 additions & 0 deletions src/Dialect/ONNX/ONNX.td
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ def ONNXConstantOpFromDenseAttr: NativeCodeCall<
class ONNX_Op<string mnemonic, list<Trait> traits = []> :
Op<ONNX_Dialect, mnemonic, traits> ;

// Trait to specify which operation set introduced a revision of an operator.
// For multi-versioned operators, the version also appears in the operator's name.
class OpVersionTrait<int version>
: ParamNativeOpTrait<"OpVersionTrait", !cast<string>(version)>;

// The tablegen code onnxop.in is generated with gen_doc.py
// clone and install onnx
// git clone --recursive https://github.com/onnx/onnx.git
Expand Down
1 change: 1 addition & 0 deletions src/Dialect/ONNX/ONNXOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "src/Dialect/ONNX/ONNXAttributes.hpp"
#include "src/Dialect/ONNX/ONNXDialect.hpp"
#include "src/Dialect/ONNX/ONNXOps/ShapeHelper.hpp"
#include "src/Dialect/ONNX/ONNXTraits.hpp"
#include "src/Dialect/ONNX/ONNXTypes.hpp"
#include "src/Interface/HasOnnxSubgraphOpInterface.hpp"
#include "src/Interface/ResultTypeInferenceOpInterface.hpp"
Expand Down
Loading

0 comments on commit 67cb3a6

Please sign in to comment.