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

add onnx op fields and remove OpBuildTable.inc #2249

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sorenlassen
Copy link
Member

@sorenlassen sorenlassen commented May 16, 2023

Added ONNXOperationTrait to every ONNX operations generated from the ONNX spec by gen_onnx_mlir.py. The trait makes it possible with std::is_base_of_v<ONNXOperationTrait<OP>, OP> to test if an operation type OP is generated from the spec, and it gives access to the onnx name, domain, and since_version. When there are multiple operation types for a single ONNX spec op type, like ONNXUnqueezeOp and ONNXUnsqueezeV11OP, they will have the same name and domain and different since_versions. (The implementation of ONNXOperationTrait is done via corresponding generated static fields onnxName, onnxDomain, onnxSinceVersion in the generated op. I might change change ONNXOperationTrait to an OpInterface and generate implementations of its declared methods instead of the static fields.)

Removed OpBuilder.inc and instead FrontendDialectTransformer now runs through the tablegen operation types in the dialect by calling foreachONNXOp() with a generic lambda to which is called with a null operation of each type. Via ONNXOperationTrait it can query the op name, domain, and since_version to build the needed tables.

Changed the custom import handler methods ImportCategoryMapper(), ImportScan(), etc to template specializations buildOperation<ONNXCategoryMapperOp>(), buildOperation<ONNXScanOp>(), etc.

…dTable.inc

Signed-off-by: Soren Lassen <sorenlassen@gmail.com>
Signed-off-by: Soren Lassen <sorenlassen@gmail.com>
Signed-off-by: Soren Lassen <sorenlassen@gmail.com>
Signed-off-by: Soren Lassen <sorenlassen@gmail.com>
Signed-off-by: Soren Lassen <sorenlassen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant