Repository navigation
[Inductor] Fix Enum serialization in user-defined Triton kernel codegen (#175900) - #175900
shafeeqi-meta wants to merge 1 commit into
Conversation
|
This appears to be a diff that was exported from phabricator, but the PR author does not have sufficient permissions to run CI. @shafeeqi-meta, please do step 2 of internal wiki to get write access so you do not need to get CI approvals in the future. If you think this is a mistake, please contact the Pytorch Dev Infra team. |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/175900
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit 4aefd2c with merge base 1d7fb59 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
This PR needs a
|
|
@shafeeqi-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92433313. |
c47a104 to
52fc9c9
Compare
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Differential Revision: D92433313
52fc9c9 to
a27e2bf
Compare
…en (pytorch#175900) Summary: Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Differential Revision: D92433313
|
@shafeeqi-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92433313. |
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Differential Revision: D92433313
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Differential Revision: D92433313
a27e2bf to
f6cf51e
Compare
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Differential Revision: D92433313
…en (pytorch#175900) Summary: Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Differential Revision: D92433313
f6cf51e to
b25057f
Compare
b25057f to
10880a1
Compare
…en (pytorch#175900) Summary: Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag Differential Revision: D92433313
10880a1 to
f2777d9
Compare
f2777d9 to
e214199
Compare
|
|
…en (pytorch#175900) Summary: Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
040d127 to
7ac7ea2
Compare
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
7ac7ea2 to
ef5d30a
Compare
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
ef5d30a to
832570c
Compare
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
832570c to
9cbce03
Compare
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
9cbce03 to
ce5d36b
Compare
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
|
@claude explain those CI failures, are they related to this PR? |
|
Claude finished @jansel's task in 50s —— View job CI failure analysis
Short answer: Only the lint failure is caused by this PR. The other 8 are pre-existing broken-trunk failures unrelated to your change. ❌ Related to this PR (1 failure)
if isinstance(obj, tuple) and hasattr(obj, "_fields"):
return getattr(type(obj), "_make")( # <-- B009: getattr with a constant attr
_sanitize_for_repr(getattr(obj, field)) for field in obj._fields
)
if isinstance(obj, tuple) and hasattr(obj, "_fields"):
return type(obj)._make(
_sanitize_for_repr(getattr(obj, field)) for field in obj._fields
)(The inner ✅ NOT related to this PR (8 failures)Dr. CI classifies all of these as BROKEN TRUNK — they also fail on the merge base commit
These are infra/environment/pre-existing problems. Rebasing onto Recommendation: Run |
…en (pytorch#175900) Summary: User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
ce5d36b to
4aefd2c
Compare
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: Pull Request resolved: pytorch#189494 ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313
…en (pytorch#189494) (pytorch#189494) Summary: ~~Pull Request resolved: pytorch#175900 User-defined Triton kernels can have `triton_meta` dicts containing Enum values (e.g., `RoundingMode.even` from fbgemm). When these are serialized with `repr()`, they produce invalid Python syntax like `<RoundingMode.even: 2>`. This adds a `_sanitize_for_repr` helper that recursively converts Enum values to their underlying value via `obj.value` before code generation. This handles IntEnum, StrEnum, and any other Enum subclass generically. Test Plan: Added unit test `test_sanitize_for_repr` in test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values. Reviewed By: malaybag, angelayi Differential Revision: D92433313 Pull Request resolved: pytorch#189494 Approved by: https://github.com/angelayi
Summary:
User-defined Triton kernels can have
triton_metadicts containing Enum values(e.g.,
RoundingMode.evenfrom fbgemm). When these are serialized withrepr(),they produce invalid Python syntax like
<RoundingMode.even: 2>.This adds a
_sanitize_for_reprhelper that recursively converts Enum valuesto their underlying value via
obj.valuebefore code generation. This handlesIntEnum, StrEnum, and any other Enum subclass generically.
Test Plan: Added unit test
test_sanitize_for_reprin test_codegen_triton.py covering Enum, IntEnum, nested containers, namedtuples, and passthrough of non-enum values.Reviewed By: malaybag, angelayi
Differential Revision: D92433313