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

Cleanup optimizer #1904

Merged
merged 7 commits into from
Oct 14, 2024
Merged

Cleanup optimizer #1904

merged 7 commits into from
Oct 14, 2024

Conversation

gramalingam
Copy link
Collaborator

Cleanup optimizer by moving older proto-based optimizations into a _legacy folder, renaming files to distinguish internal implementation files, and other minor restructuring.

Copy link

codecov bot commented Oct 13, 2024

❌ 14 Tests Failed:

Tests completed Failed Passed Skipped
12902 14 12888 2635
View the top 3 failed tests by shortest run time
tests.ir.serde_roundtrip_test.SerdeTest test_serialization_deserialization_produces_same_model_0141_test_cast_FLOAT4E2M1_to_FLOAT16_model_onnx
Stack Traces | 0.001s run time
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:711: in deserialize_type_proto_for_type
    return _core.TensorType(_enums.DataType(elem_type), denotation=denotation)
.../hostedtoolcache/Python/3.11.10....../x64/lib/python3.11/enum.py:714: in __call__
    return cls.__new__(cls, value)
.../hostedtoolcache/Python/3.11.10....../x64/lib/python3.11/enum.py:1137: in __new__
    raise ve_exc
E   ValueError: 23 is not a valid DataType

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:657: in deserialize_value_info_proto
    value.type = deserialize_type_proto_for_type(proto.type)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_type_proto_for_type with: tensor_type {
E     elem_type: 23
E     shape {
E       dim {
E         dim_value: 3
E       }
E       dim {
E         dim_value: 5
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:568: in _deserialize_graph
    deserialize_value_info_proto(info, value)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_value_info_proto with: name: "input"
E   type {
E     tensor_type {
E       elem_type: 23
E       shape {
E         dim {
E           dim_value: 3
E         }
E         dim {
E           dim_value: 5
E         }
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
..../test_onnx_weekly/lib/python3.11.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
tests/ir/serde_roundtrip_test.py:38: in test_serialization_deserialization_produces_same_model
    ir_model = ir.serde.deserialize_model(model)
onnxscript/ir/serde.py:459: in deserialize_model
    graph = _deserialize_graph(proto.graph, [])
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling _deserialize_graph with: main_graph
tests.ir.serde_roundtrip_test.SerdeTest test_serialization_deserialization_produces_same_model_0430_test_dequantizelinear_float4e2m1_model_onnx
Stack Traces | 0.001s run time
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:711: in deserialize_type_proto_for_type
    return _core.TensorType(_enums.DataType(elem_type), denotation=denotation)
....../Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:714: in __call__
    return cls.__new__(cls, value)
....../Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1137: in __new__
    raise ve_exc
E   ValueError: 23 is not a valid DataType

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:657: in deserialize_value_info_proto
    value.type = deserialize_type_proto_for_type(proto.type)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_type_proto_for_type with: tensor_type {
E     elem_type: 23
E     shape {
E       dim {
E         dim_value: 5
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:568: in _deserialize_graph
    deserialize_value_info_proto(info, value)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_value_info_proto with: name: "x"
E   type {
E     tensor_type {
E       elem_type: 23
E       shape {
E         dim {
E           dim_value: 5
E         }
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
..../test_onnx_weekly/lib/python3.11.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
tests/ir/serde_roundtrip_test.py:38: in test_serialization_deserialization_produces_same_model
    ir_model = ir.serde.deserialize_model(model)
onnxscript/ir/serde.py:459: in deserialize_model
    graph = _deserialize_graph(proto.graph, [])
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling _deserialize_graph with: main_graph
tests.ir.serde_roundtrip_test.SerdeTest test_serialization_deserialization_produces_same_model_0669_test_cast_FLOAT_to_FLOAT4E2M1_model_onnx
Stack Traces | 0.001s run time
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:711: in deserialize_type_proto_for_type
    return _core.TensorType(_enums.DataType(elem_type), denotation=denotation)
....../Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:714: in __call__
    return cls.__new__(cls, value)
....../Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1137: in __new__
    raise ve_exc
E   ValueError: 23 is not a valid DataType

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:657: in deserialize_value_info_proto
    value.type = deserialize_type_proto_for_type(proto.type)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_type_proto_for_type with: tensor_type {
E     elem_type: 23
E     shape {
E       dim {
E         dim_value: 3
E       }
E       dim {
E         dim_value: 5
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:600: in _deserialize_graph
    outputs = [deserialize_value_info_proto(info, values[info.name]) for info in proto.output]
onnxscript/ir/serde.py:600: in <listcomp>
    outputs = [deserialize_value_info_proto(info, values[info.name]) for info in proto.output]
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_value_info_proto with: name: "output"
E   type {
E     tensor_type {
E       elem_type: 23
E       shape {
E         dim {
E           dim_value: 3
E         }
E         dim {
E           dim_value: 5
E         }
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
..../test_onnx_weekly/lib/python3.11.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
tests/ir/serde_roundtrip_test.py:38: in test_serialization_deserialization_produces_same_model
    ir_model = ir.serde.deserialize_model(model)
onnxscript/ir/serde.py:459: in deserialize_model
    graph = _deserialize_graph(proto.graph, [])
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling _deserialize_graph with: main_graph

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

onnxscript/optimizer/__init__.py Dismissed Show dismissed Hide dismissed
onnxscript/optimizer/_legacy/_optimizer.py Fixed Show fixed Hide fixed
onnxscript/optimizer/_legacy/_optimizer.py Fixed Show fixed Hide fixed
onnxscript/optimizer/_legacy/_optimizer.py Fixed Show fixed Hide fixed
onnxscript/optimizer/_legacy/_optimizer.py Fixed Show fixed Hide fixed
onnxscript/optimizer/_optimizer.py Fixed Show fixed Hide fixed
onnxscript/optimizer/_optimizer.py Fixed Show fixed Hide fixed
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.

Thanks!

@justinchuby
Copy link
Collaborator

The exclude patterns may need to be updated: https://github.com/microsoft/onnxscript/blob/main/.lintrunner.toml#L39

@gramalingam gramalingam enabled auto-merge (squash) October 14, 2024 19:21
.lintrunner.toml Outdated Show resolved Hide resolved
@justinchuby justinchuby merged commit 4578142 into main Oct 14, 2024
25 of 41 checks passed
@justinchuby justinchuby deleted the rama/cleanup-optimizer branch October 14, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants