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

[GatherND]: Implement verification, shape inference, and code gen. #1382

Merged
merged 22 commits into from
May 5, 2022

Conversation

etiotto
Copy link
Collaborator

@etiotto etiotto commented Apr 22, 2022

Implement support for the ONNX GatherND operator:

  • verification code (diagnose operator constraints)
  • shape inference with helper
  • codegen support
  • lit tests to verify constraint diagnostics
  • lit tests to verify shape inference
  • add lit test to verify code generation
  • enable end-to-end test (backend test)

Signed-off-by: Ettore Tiotto etiotto@ca.ibm.com

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
@etiotto etiotto self-assigned this Apr 22, 2022
@etiotto etiotto changed the title [GatherND]: verification code [GatherND]: Implement verification, shape inference, and code gen. Apr 22, 2022
Ettore Tiotto added 6 commits April 25, 2022 16:31
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
@etiotto etiotto mentioned this pull request Apr 27, 2022
Ettore Tiotto added 2 commits April 27, 2022 11:57
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
@etiotto etiotto marked this pull request as ready for review April 28, 2022 16:22
@etiotto etiotto marked this pull request as draft April 28, 2022 19:01
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
@etiotto etiotto marked this pull request as ready for review April 28, 2022 20:30
Ettore Tiotto added 2 commits May 2, 2022 10:42
Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlexandreEichenberger
Copy link
Collaborator

@sstamenova I am seeing MLIR-Windows-CI cancelled. Would you be able to let us know what is happening? I have seen it for many other PRs as well. Thanks

@AlexandreEichenberger
Copy link
Collaborator

@etiotto there seems to be an issue during compilation

ile included from /workdir/onnx-mlir/src/Runtime/OMTensor.cpp:16:
/workdir/onnx-mlir/src/Runtime/OMTensor.inc: In function 'void omTensorPrint(const char*, const OMTensor*)':
/workdir/onnx-mlir/src/Runtime/OMTensor.inc:475:24: error: taking address of temporary array
  475 |     LOOP_1(((int64_t[]){i}), i, shape[0])
      |            ~~~~~~~~~~~~^~~~

@sstamenova
Copy link
Collaborator

@sstamenova I am seeing MLIR-Windows-CI cancelled. Would you be able to let us know what is happening? I have seen it for many other PRs as well. Thanks

There's most likely an outage that's impacting the builds - the logs don't seem to indicate that anything else is going on. :(. Let me know if it persists and I'll spend some more time looking into it, but if it's an outage, I expect it will go back to normal soon.

@etiotto
Copy link
Collaborator Author

etiotto commented May 3, 2022

@etiotto there seems to be an issue during compilation

ile included from /workdir/onnx-mlir/src/Runtime/OMTensor.cpp:16:
/workdir/onnx-mlir/src/Runtime/OMTensor.inc: In function 'void omTensorPrint(const char*, const OMTensor*)':
/workdir/onnx-mlir/src/Runtime/OMTensor.inc:475:24: error: taking address of temporary array
  475 |     LOOP_1(((int64_t[]){i}), i, shape[0])
      |            ~~~~~~~~~~~~^~~~

I am using compound literals (https://en.cppreference.com/w/c/language/compound_literal) which are legal constructs since C99. Likely the issue here is that OMTensor.inc is included in both OMTensor.c and OMTensor.cpp and when compiling OMTensor.cpp the C++ compiler emits a warning because unfort. compound literals aren't part of the C++ standard specification.

@AlexandreEichenberger
Copy link
Collaborator

It does not seems to be a warning, I see an "Error"

@etiotto
Copy link
Collaborator Author

etiotto commented May 3, 2022

Yes I pushed a fix now.

@etiotto
Copy link
Collaborator Author

etiotto commented May 3, 2022

@sstamenova I have some code in OMTensor.inc that uses function like macros. The code compiles on all platforms except on Windows. Looking at the messages in the log did not really help me figuring out what the issue might be. Could you take a look if you have some time please ? Any suggestions very much appreciated.

P.S.: I could undo the change in OMTensor.inc as it is not essential for this PR. But if the issue turn out to be easy to fix that would be preferable.

Ettore Tiotto added 2 commits May 5, 2022 10:56
@etiotto
Copy link
Collaborator Author

etiotto commented May 5, 2022

@sstamenova I have some code in OMTensor.inc that uses function like macros. The code compiles on all platforms except on Windows. Looking at the messages in the log did not really help me figuring out what the issue might be. Could you take a look if you have some time please ? Any suggestions very much appreciated.

P.S.: I could undo the change in OMTensor.inc as it is not essential for this PR. But if the issue turn out to be easy to fix that would be preferable.

I got a Windows VM and was able to reproduce the issue using a cut down test. It turns out that MSVC, for historical reasons, "interprets" the C specification somewhat differently than gcc & clang. MSCV provides a compiler option (https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-170) that makes the preprocessor more conforming to the C standard. Using that flag fixed the problem for the reduced test case. I have added it to the CMakefile and triggered a new build ...

@sstamenova
Copy link
Collaborator

@sstamenova I have some code in OMTensor.inc that uses function like macros. The code compiles on all platforms except on Windows. Looking at the messages in the log did not really help me figuring out what the issue might be. Could you take a look if you have some time please ? Any suggestions very much appreciated.
P.S.: I could undo the change in OMTensor.inc as it is not essential for this PR. But if the issue turn out to be easy to fix that would be preferable.

I got a Windows VM and was able to reproduce the issue using a cut down test. It turns out that MSVC, for historical reasons, "interprets" the C specification somewhat differently than gcc & clang. MSCV provides a compiler option (https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-170) that makes the preprocessor more conforming to the C standard. Using that flag fixed the problem for the reduced test case. I have added it to the CMakefile and triggered a new build ...

@etiotto : Please let me know if it doesn't work and I'll have a look. I was OOF earlier this week, but I'm back in the office now.

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
@etiotto etiotto merged commit 25f9d89 into onnx:main May 5, 2022
@etiotto etiotto deleted the GatherND branch May 5, 2022 16:59
@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #5599 [push] [GatherND]: Implement v... started at 13:00

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #5584 [push] [GatherND]: Implement v... started at 12:00

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #4721 [push] [GatherND]: Implement v... started at 13:02

@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #5599 [push] [GatherND]: Implement v... passed after 53 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #4721 [push] [GatherND]: Implement v... passed after 57 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #5584 [push] [GatherND]: Implement v... passed after 1 hr 2 min

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.

4 participants