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

Track nodes added in pattern builder #1770

Merged
merged 13 commits into from
Aug 2, 2024
Merged

Conversation

gramalingam
Copy link
Collaborator

This fixes a couple of issues with the graph pattern builder by explicitly tracking the nodes added/created. This ensures that node ordering is exactly the same as what the user specifies (which helps with debugging and the verbose logs). In addition, we use a context manager to track the nodes added via the use of overloaded operators like + and *.

This also impacts how the "commuted" GraphPatterns are constructed. This has also been cleaned up (allowing commute to handle multiple output nodes as well).

Remove the unused "onnxop" imports left over after some refactoring a while back.

onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
onnxscript/rewriter/pattern.py Fixed Show fixed Hide fixed
Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 94.79167% with 5 lines in your changes missing coverage. Please review.

Project coverage is 75.04%. Comparing base (23e1fcb) to head (4a2f311).

Files Patch % Lines
onnxscript/rewriter/pattern.py 94.11% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1770      +/-   ##
==========================================
- Coverage   75.06%   75.04%   -0.02%     
==========================================
  Files         245      245              
  Lines       26436    26472      +36     
  Branches     4822     4829       +7     
==========================================
+ Hits        19844    19867      +23     
- Misses       5660     5674      +14     
+ Partials      932      931       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Aug 1, 2024

Test Results

     24 files  ±    0      24 suites  ±0   3h 10m 31s ⏱️ - 12m 44s
 14 296 tests  - 1 412  12 100 ✅  - 1 597    2 160 💤 +180   36 ❌ +5 
459 748 runs  +   58  97 316 ✅  -   185  362 158 💤 +238  274 ❌ +5 

For more details on these failures, see this check.

Results for commit 4a2f311. ± Comparison against base commit 23e1fcb.

This pull request removes 3734 and adds 2322 tests. Note that renamed tests count towards both.
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0289_test_convtranspose_kernel_shape
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0290_test_convtranspose_output_shape
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0291_test_convtranspose_pad
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0292_test_convtranspose_pads
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0293_test_conv_with_autopad_same
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0294_test_conv_with_strides_and_asymmetric_padding
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0295_test_conv_with_strides_no_padding
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0296_test_conv_with_strides_padding
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0297_test_cos
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0298_test_cosh
…
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0289_test_convtranspose_group_2
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0290_test_convtranspose_group_2_image_3
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0291_test_convtranspose_kernel_shape
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0292_test_convtranspose_output_shape
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0293_test_convtranspose_pad
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0294_test_convtranspose_pads
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0295_test_conv_with_autopad_same
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0296_test_conv_with_strides_and_asymmetric_padding
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0297_test_conv_with_strides_no_padding
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0298_test_conv_with_strides_padding
…
This pull request removes 224 skipped tests and adds 362 skipped tests. Note that renamed tests count towards both.
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0308_test_deform_conv_with_mask_bias
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0309_test_deform_conv_with_multiple_offset_groups
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0312_test_dequantizelinear
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0313_test_dequantizelinear_axis
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0314_test_dequantizelinear_blocked
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0315_test_dequantizelinear_e4m3fn
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0316_test_dequantizelinear_e4m3fn_float16
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0317_test_dequantizelinear_e4m3fn_zero_point
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0318_test_dequantizelinear_e5m2
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0319_test_dequantizelinear_int16
…
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0289_test_convtranspose_group_2
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0290_test_convtranspose_group_2_image_3
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0291_test_convtranspose_kernel_shape
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0292_test_convtranspose_output_shape
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0293_test_convtranspose_pad
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0294_test_convtranspose_pads
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0295_test_conv_with_autopad_same
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0296_test_conv_with_strides_and_asymmetric_padding
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0297_test_conv_with_strides_no_padding
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0298_test_conv_with_strides_padding
…
This pull request skips 43 and un-skips 1 tests.
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0001_test_acos
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0002_test_acosh
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0003_test_acosh_example
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0004_test_acos_example
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0068_test_asin
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0069_test_asinh
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0070_test_asinh_example
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0071_test_asin_example
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0072_test_atan
onnxscript.backend.onnx_export_test.TestOnnxBackEnd ‑ test_export2python_produces_correct_onnx_script_model_0073_test_atanh
…
onnxscript.ir.serde_test.TensorProtoTensorTest ‑ test_tensor_proto_tensor_bfloat16

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

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

🎉

@gramalingam gramalingam merged commit 14f88d3 into main Aug 2, 2024
29 of 43 checks passed
@gramalingam gramalingam deleted the rama/pattern-builder-context branch August 2, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants