-
Notifications
You must be signed in to change notification settings - Fork 516
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
Sigmoid lowering to linalg #294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR!
For testing, could you add e2e test following the examples in https://github.com/llvm/mlir-npcomp/blob/main/frontends/pytorch/e2e_testing/torchscript/elementwise.py.
For git commits history, can you rebase your change on the latest head without merge so the commits history would look cleaner. And because all the commits are related to supporting sigmoid
, it's better to squash them into one commit.
82e72b6
to
3769aee
Compare
Follows existing conventions for activation functions
3769aee
to
452242b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
* Define krnl.permute op. * Support krnl.permute operation. * Properly remove loop references. * Re-push, Github was down. * Need to debug interpretOp error. * Fix lowering bug by erasing ops after full krnl IR interpretation is done, and clean up & comment code. * Introduce permute, unroll operations. * More debug. * Remove std::set. * krnl.terminate fails to be converted. * Pass all tests, need to add legal ops as well as part of the conversion target. * Change test format to new permute spec. * Bug fix for nested iterate op lowering. * Simplify error reporting. * Fix compilation error. * Increase comments coverage. * Remove unnecessary imports. * Re-trigger Jenkins * Add permute/unroll tests. * Retrigger Jenkins * initial implementation of gather * added tests * format * remove affine load for second load, as it uses an indirection * changes suggested by reviewers * remove backend tests until I can verify them locally Co-authored-by: Tian Jin <[email protected]>
* NFC: Attribute cleanup (remove references of attributes) (llvm#286) * Define krnl.permute op. * Support krnl.permute operation. * Properly remove loop references. * Re-push, Github was down. * Need to debug interpretOp error. * Fix lowering bug by erasing ops after full krnl IR interpretation is done, and clean up & comment code. * Introduce permute, unroll operations. * More debug. * Remove std::set. * krnl.terminate fails to be converted. * Pass all tests, need to add legal ops as well as part of the conversion target. * Change test format to new permute spec. * Bug fix for nested iterate op lowering. * Simplify error reporting. * Fix compilation error. * Increase comments coverage. * Remove unnecessary imports. * Re-trigger Jenkins * Add permute/unroll tests. * Retrigger Jenkins * remove & (ref) for Attributes Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * Syntax highlighting for mlir code in README (llvm#276) * Syntax highlighting for mlir code in README * Restart Jenkins Co-authored-by: Gheorghe-Teodor Bercea <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * use print not dump Signed-off-by: Kevin O'Brien <[email protected]> * add semicolon Signed-off-by: Kevin O'Brien <[email protected]> * syntax Signed-off-by: Kevin O'Brien <[email protected]> * add code to preserve locations Signed-off-by: Kevin O'Brien <[email protected]> * format Signed-off-by: Kevin O'Brien <[email protected]> * Emit the dynamic memory pool (llvm#290) * Reorganize main function. * Follow review comments. * Emit constants are globals in Krnl and LLVM dialects. * Add support for bundling dynamic memory pools. * Add dynamic bundling. * Clean-up code. * Clean-up file. * Add test for bundling dynamic memory pool. * Fixes. Simplify data structure. Add mixed test. * Remove unused import. Signed-off-by: Kevin O'Brien <[email protected]> * Fix wrong type for llvm::loadop (llvm#293) Signed-off-by: Kevin O'Brien <[email protected]> * Update llvm commit ID to 1d01fc1 (llvm#292) * Fix for LLVM revision D85495 * Fix for LLVM revision DD86121 * Fix for LLVM revision D85622 (f9dc2b7) TODO: Change preloadDialectsInContext to false Memo for previous fixes: D86121 (250f43d), D85495 (575b22b) * clang-format * Update llvm commit ID of README and clone-mlir.sh * Updated llvm commit ID of README.md * Fix for passing backend tests * Removed the commented code * Empty commit for triggering rebuild * Test multi-stage travis build * Specify stage order. * Empty commit for triggering rebuild * Update prereq.s390x.Dockerfile Make it possible to execute s390x prereq docker multiple times. * Build prereq for each arch * Fix multi-arch prereq build. * timeout at 40m * Update .travis.yml * add ppc64le prereq builder * Run ppc docker prereq build multiple times * Do not test branch update unless it's mater. * Fix dockerfile. * Fix typo in travis.yml. * Fix ppc64 docker file * Update .travis.yml * turn off metacopy on ppc64le * Update .travis.yml * Turn off metacopy. * Turn off metacopy inside Dockerfile in ppc64. * No sudo in Docker. * Remove metacopy config from Dockerfile. * Change base image to be bionic. * Using newer linux distro for ppc64. * Turn off metacopy in before_install. * Fix sudo permission issue. * Run docker info. * Allow amd64 docker file to be built multiple times * Support building amd64 prereq. * Fix amd64 docker file typo. * fix ppc64le dockerfile typo. * timeout from 40m -> 30m * 40m->30m * 40m->30m * fix bug preventing incremental build. * fix bug preventing incremental build. * Bump CircleCI cache version. * Push to production prereq container repository and condition prereq docker rebuild on commit message. * Rebuild prereq docker. * Move default script to top-level. * Python not properly installed. * amd64 -> x86 * Rebuild prereq docker. * Rebuild prereq docker. * Rebuild prereq docker. * Restart all CI. * Disallow cache on Jenkins docker build. * Restart zJenkins. * Restart zJenkins. Co-authored-by: Haruki Imai <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * Using onnx-mlir through incremental stages (llvm#257) * Add lowering of Vector dialect for lower-all-llvm pass * Fix generating CallOp instructions when return type is void * Fix lowering of memref * Reformat using clang-format * Record more context. * Reflow comments. Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * Dropout elimination & Conv Bugfix (llvm#297) * Dropout elimination. * Test VGG19. * Add shufflenet. * Fix grouped convolution bug. * Fix lit test failure. Signed-off-by: Kevin O'Brien <[email protected]> * Rewrite shape and size OP (llvm#285) * add shape inference * Revert "add shape inference" This reverts commit f9d42f39e68e14b5648abccfc8617fff00244d16. * add rewrite rules * test cases * format * add constraint * response to review * response to review Signed-off-by: Kevin O'Brien <[email protected]> * initial code for handling custom ops (llvm#288) * initial code for handling custom ops * format Signed-off-by: Kevin O'Brien <[email protected]> * ShapeInference for SizeOp (llvm#299) * add shape inference * Revert "add shape inference" This reverts commit f9d42f39e68e14b5648abccfc8617fff00244d16. * shape inference * test case * format Signed-off-by: Kevin O'Brien <[email protected]> * Gather ONNX to Kernel Lowering (llvm#294) * Define krnl.permute op. * Support krnl.permute operation. * Properly remove loop references. * Re-push, Github was down. * Need to debug interpretOp error. * Fix lowering bug by erasing ops after full krnl IR interpretation is done, and clean up & comment code. * Introduce permute, unroll operations. * More debug. * Remove std::set. * krnl.terminate fails to be converted. * Pass all tests, need to add legal ops as well as part of the conversion target. * Change test format to new permute spec. * Bug fix for nested iterate op lowering. * Simplify error reporting. * Fix compilation error. * Increase comments coverage. * Remove unnecessary imports. * Re-trigger Jenkins * Add permute/unroll tests. * Retrigger Jenkins * initial implementation of gather * added tests * format * remove affine load for second load, as it uses an indirection * changes suggested by reviewers * remove backend tests until I can verify them locally Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * add lit test Signed-off-by: Kevin O'Brien <[email protected]> * fix option spelling Signed-off-by: Kevin O'Brien <[email protected]> * braces in wrong place Signed-off-by: Kevin O'Brien <[email protected]> * add lit test Signed-off-by: Kevin O'Brien <[email protected]> * remove duplicate code from lit test Signed-off-by: Kevin O'Brien <[email protected]> * Simplify lit test Signed-off-by: Kevin O'Brien <[email protected]> * remove attributes from lit test Signed-off-by: Kevin O'Brien <[email protected]> * add onnx-mlir-opt to tool names Signed-off-by: Kevin O'Brien <[email protected]> * add printIR to second RUN Signed-off-by: Kevin O'Brien <[email protected]> * redo adding printIR Signed-off-by: Kevin O'Brien <[email protected]> * fix bug Signed-off-by: Kevin O'Brien <[email protected]> * format Signed-off-by: Kevin O'Brien <[email protected]> * fix typo in test Signed-off-by: Kevin O'Brien <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Co-authored-by: Tian Jin <[email protected]> Co-authored-by: Tung D. Le <[email protected]> Co-authored-by: Gheorghe-Teodor Bercea <[email protected]> Co-authored-by: Haruki Imai <[email protected]> Co-authored-by: Kevin Wu <[email protected]> Co-authored-by: chentong319 <[email protected]>
* Improve support for krnl.dim (llvm#317) * Reorganize main function. * Follow review comments. * Emit constants are globals in Krnl and LLVM dialects. * Make krnl dim more robust. * Format. * Update comments. * Change pass name. Signed-off-by: Tung D. Le <[email protected]> * Initial Location info support (llvm#302) * NFC: Attribute cleanup (remove references of attributes) (llvm#286) * Define krnl.permute op. * Support krnl.permute operation. * Properly remove loop references. * Re-push, Github was down. * Need to debug interpretOp error. * Fix lowering bug by erasing ops after full krnl IR interpretation is done, and clean up & comment code. * Introduce permute, unroll operations. * More debug. * Remove std::set. * krnl.terminate fails to be converted. * Pass all tests, need to add legal ops as well as part of the conversion target. * Change test format to new permute spec. * Bug fix for nested iterate op lowering. * Simplify error reporting. * Fix compilation error. * Increase comments coverage. * Remove unnecessary imports. * Re-trigger Jenkins * Add permute/unroll tests. * Retrigger Jenkins * remove & (ref) for Attributes Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * Syntax highlighting for mlir code in README (llvm#276) * Syntax highlighting for mlir code in README * Restart Jenkins Co-authored-by: Gheorghe-Teodor Bercea <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * use print not dump Signed-off-by: Kevin O'Brien <[email protected]> * add semicolon Signed-off-by: Kevin O'Brien <[email protected]> * syntax Signed-off-by: Kevin O'Brien <[email protected]> * add code to preserve locations Signed-off-by: Kevin O'Brien <[email protected]> * format Signed-off-by: Kevin O'Brien <[email protected]> * Emit the dynamic memory pool (llvm#290) * Reorganize main function. * Follow review comments. * Emit constants are globals in Krnl and LLVM dialects. * Add support for bundling dynamic memory pools. * Add dynamic bundling. * Clean-up code. * Clean-up file. * Add test for bundling dynamic memory pool. * Fixes. Simplify data structure. Add mixed test. * Remove unused import. Signed-off-by: Kevin O'Brien <[email protected]> * Fix wrong type for llvm::loadop (llvm#293) Signed-off-by: Kevin O'Brien <[email protected]> * Update llvm commit ID to 1d01fc1 (llvm#292) * Fix for LLVM revision D85495 * Fix for LLVM revision DD86121 * Fix for LLVM revision D85622 (f9dc2b7) TODO: Change preloadDialectsInContext to false Memo for previous fixes: D86121 (250f43d), D85495 (575b22b) * clang-format * Update llvm commit ID of README and clone-mlir.sh * Updated llvm commit ID of README.md * Fix for passing backend tests * Removed the commented code * Empty commit for triggering rebuild * Test multi-stage travis build * Specify stage order. * Empty commit for triggering rebuild * Update prereq.s390x.Dockerfile Make it possible to execute s390x prereq docker multiple times. * Build prereq for each arch * Fix multi-arch prereq build. * timeout at 40m * Update .travis.yml * add ppc64le prereq builder * Run ppc docker prereq build multiple times * Do not test branch update unless it's mater. * Fix dockerfile. * Fix typo in travis.yml. * Fix ppc64 docker file * Update .travis.yml * turn off metacopy on ppc64le * Update .travis.yml * Turn off metacopy. * Turn off metacopy inside Dockerfile in ppc64. * No sudo in Docker. * Remove metacopy config from Dockerfile. * Change base image to be bionic. * Using newer linux distro for ppc64. * Turn off metacopy in before_install. * Fix sudo permission issue. * Run docker info. * Allow amd64 docker file to be built multiple times * Support building amd64 prereq. * Fix amd64 docker file typo. * fix ppc64le dockerfile typo. * timeout from 40m -> 30m * 40m->30m * 40m->30m * fix bug preventing incremental build. * fix bug preventing incremental build. * Bump CircleCI cache version. * Push to production prereq container repository and condition prereq docker rebuild on commit message. * Rebuild prereq docker. * Move default script to top-level. * Python not properly installed. * amd64 -> x86 * Rebuild prereq docker. * Rebuild prereq docker. * Rebuild prereq docker. * Restart all CI. * Disallow cache on Jenkins docker build. * Restart zJenkins. * Restart zJenkins. Co-authored-by: Haruki Imai <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * Using onnx-mlir through incremental stages (llvm#257) * Add lowering of Vector dialect for lower-all-llvm pass * Fix generating CallOp instructions when return type is void * Fix lowering of memref * Reformat using clang-format * Record more context. * Reflow comments. Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * Dropout elimination & Conv Bugfix (llvm#297) * Dropout elimination. * Test VGG19. * Add shufflenet. * Fix grouped convolution bug. * Fix lit test failure. Signed-off-by: Kevin O'Brien <[email protected]> * Rewrite shape and size OP (llvm#285) * add shape inference * Revert "add shape inference" This reverts commit f9d42f39e68e14b5648abccfc8617fff00244d16. * add rewrite rules * test cases * format * add constraint * response to review * response to review Signed-off-by: Kevin O'Brien <[email protected]> * initial code for handling custom ops (llvm#288) * initial code for handling custom ops * format Signed-off-by: Kevin O'Brien <[email protected]> * ShapeInference for SizeOp (llvm#299) * add shape inference * Revert "add shape inference" This reverts commit f9d42f39e68e14b5648abccfc8617fff00244d16. * shape inference * test case * format Signed-off-by: Kevin O'Brien <[email protected]> * Gather ONNX to Kernel Lowering (llvm#294) * Define krnl.permute op. * Support krnl.permute operation. * Properly remove loop references. * Re-push, Github was down. * Need to debug interpretOp error. * Fix lowering bug by erasing ops after full krnl IR interpretation is done, and clean up & comment code. * Introduce permute, unroll operations. * More debug. * Remove std::set. * krnl.terminate fails to be converted. * Pass all tests, need to add legal ops as well as part of the conversion target. * Change test format to new permute spec. * Bug fix for nested iterate op lowering. * Simplify error reporting. * Fix compilation error. * Increase comments coverage. * Remove unnecessary imports. * Re-trigger Jenkins * Add permute/unroll tests. * Retrigger Jenkins * initial implementation of gather * added tests * format * remove affine load for second load, as it uses an indirection * changes suggested by reviewers * remove backend tests until I can verify them locally Co-authored-by: Tian Jin <[email protected]> Signed-off-by: Kevin O'Brien <[email protected]> * add lit test Signed-off-by: Kevin O'Brien <[email protected]> * fix option spelling Signed-off-by: Kevin O'Brien <[email protected]> * braces in wrong place Signed-off-by: Kevin O'Brien <[email protected]> * add lit test Signed-off-by: Kevin O'Brien <[email protected]> * remove duplicate code from lit test Signed-off-by: Kevin O'Brien <[email protected]> * Simplify lit test Signed-off-by: Kevin O'Brien <[email protected]> * remove attributes from lit test Signed-off-by: Kevin O'Brien <[email protected]> * add onnx-mlir-opt to tool names Signed-off-by: Kevin O'Brien <[email protected]> * add printIR to second RUN Signed-off-by: Kevin O'Brien <[email protected]> * redo adding printIR Signed-off-by: Kevin O'Brien <[email protected]> * fix bug Signed-off-by: Kevin O'Brien <[email protected]> * format Signed-off-by: Kevin O'Brien <[email protected]> * fix typo in test Signed-off-by: Kevin O'Brien <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Co-authored-by: Tian Jin <[email protected]> Co-authored-by: Tung D. Le <[email protected]> Co-authored-by: Gheorghe-Teodor Bercea <[email protected]> Co-authored-by: Haruki Imai <[email protected]> Co-authored-by: Kevin Wu <[email protected]> Co-authored-by: chentong319 <[email protected]> Signed-off-by: Tung D. Le <[email protected]> * Support ReduceMean Signed-off-by: Tung D. Le <[email protected]> * Add lit tests Signed-off-by: Tung D. Le <[email protected]> * Fix unknown dimensions for type f32 Signed-off-by: Tung D. Le <[email protected]> Co-authored-by: Gheorghe-Teodor Bercea <[email protected]> Co-authored-by: Kevin O'Brien <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Co-authored-by: Tian Jin <[email protected]> Co-authored-by: Haruki Imai <[email protected]> Co-authored-by: Kevin Wu <[email protected]> Co-authored-by: chentong319 <[email protected]>
Adds a pretty straightforward lowering for Sigmoid following the existing conventions for relu and tanh.
Would it be appropriate to mirror the lit tests for tanh in ./test/Conversion/TorchToLinalg/elementwise.mlir and /test/Dialect/Torch/refine-types.mlir? Any other tests required for this kind of patch?