Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/185390
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 5 PendingAs of commit 26e218a with merge base fbaa4b1 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@ddneilson has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105760965. |
ca4a467 to
7e5cbe3
Compare
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
0244812 to
0efb366
Compare
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
0efb366 to
1e2ac6b
Compare
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
1e2ac6b to
40c9ad9
Compare
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Pull Request resolved: pytorch#185390 Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
40c9ad9 to
b44bb3e
Compare
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…d randomized hyperparameters (pytorch#185383) Summary: Backward-compatible enhancements to `PointwiseOperator` and three upstream activation operators: **`PointwiseOperator` changes (`tensor_pointwise.py`):** 1. `fuzz_inputs_specs` now randomly replaces one of the two inputs with a `ScalarSpec` (30% probability). This exercises the `torch.add(tensor, scalar)` dispatch path that is ubiquitous in real models but was never tested by the fuzzer. 2. `fuzz_inputs_specs` has a secondary 20% probability path that replaces one input's shape with a broadcast-compatible shape (via `_random_broadcast_shape`). This exercises PyTorch's implicit broadcast semantics for binary ops. 3. `symbol` parameter defaults to `""` (was required). This allows subclasses that represent named-function ops (e.g. `torch.maximum`) to skip the symbol without passing a dummy string. 4. Default `torch_op_name` property returns `self.name`. This eliminates the need for every subclass to define the same one-liner property. 5. `AddOperator.codegen` now has a 30% probability of emitting `alpha=<random>` to exercise the `torch.add(a, b, alpha=...)` path. For integer output dtypes, the alpha is truncated to `int`. **Activation operator changes (`nn_functional.py`):** 6. `GELUOperator.codegen` now randomizes `approximate=` between `"none"` and `"tanh"` (was always `"none"`). 7. `LeakyReLUOperator.codegen` now draws `negative_slope` from `Uniform(0.001, 0.5)` (was hardcoded `0.01`). 8. `ELUOperator.codegen` now draws `alpha` from `Uniform(0.1, 3.0)` (was always the PyTorch default `1.0`). Test Plan: These changes were tested as part of a collection of changes to add operator coverage to torchfuzz. Operator definitions were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (--max-depth 1 --supported-ops '<op>') so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in fuzz_inputs_specs is identified (probability p_min), then N = ceil(ln(0.05) / ln(1 - p_min)) gives 95% confidence of exercising that path at least once; N is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's fuzz_inputs_specs or codegen) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D106395651
… discovery (pytorch#185387) Summary: Replace the manual per-class imports and `self.register()` calls in `OperatorRegistry._register_default_operators()` with an introspection-based approach. A module-level `_OPERATOR_MODULES` list names each operator module; `_concrete_operator_classes()` discovers all concrete `Operator` subclasses in each module via `inspect.getmembers()`, filtering out re-exports (whose `__module__` doesn't match), abstract classes, and `*Base` helpers. This makes adding new operator modules a one-line change (append to `_OPERATOR_MODULES`) instead of adding N import lines + N `self.register()` calls. Update the README "Adding New Operations" Step 2 to document the new `_OPERATOR_MODULES` approach: create an operator file, add the module name to the list, and introspection handles the rest. Test Plan: Verified that `list_operators()` returns the same set of operator names before and after the refactor. No operators were added or removed — the only change is the discovery mechanism. Differential Revision: D106408809
…86625) Summary: `fuzz_tensor` previously called `torch.randint(-100, 100, ..., dtype=dtype)` for every non-bool, non-complex integer type. `torch.randint` requires `low` to be in the dtype's representable range, so any unsigned dtype (`uint8`, `uint16`, `uint32`, `uint64`) crashed with `RuntimeError: from is out of bounds for unsigned ...` before a program was even generated. Clamp `low` to `0` for unsigned dtypes (detected via `torch.iinfo(dtype).min`) and keep `-100` for signed dtypes. `high` is unchanged. Test Plan: Manual: ran `fuzz_tensor(dtype=d)` for `d in {uint8, uint16, uint32, uint64}` and confirmed it now returns a tensor instead of raising; values land in `[0, 100)`. Signed `int8/16/32/64` continue to produce values in `[-100, 100)`. Differential Revision: D107910279
Summary: Adds the first two operator categories from `inductor-operators.csv` to upstream torchfuzz: Tensor Creation & Initialization (10 ops) and Elementwise Math (88 ops, 5 of which reuse upstream-registered classes). **New modules:** - `operators/_dtypes.py` — shared constants and utilities: `FLOAT_DTYPES`, `is_float_dtype`, `contiguous_stride`, `random_broadcast_shape`. - `operators/tensor_creation.py` — three base classes and 10 concrete subclasses: - `TensorCreationFromSizeOperatorBase` — factory ops with 0 inputs (`ones`, `zeros`, `full`). Codegen handles non-contiguous strides via `torch.empty_strided(...).fill_()`. - `TensorCreationFromPrototypeOperatorBase` — 1 prototype input (`ones_like`, `zeros_like`, `full_like`). Non-contiguous codegen uses a two-step copy. - `TensorMethodNewOperatorBase` — `.new_X()` methods (`new_ones`, `new_zeros`, `new_full`). - `ArangeOperator` — standalone, 1-D contiguous output. - `operators/LIMITATIONS.md` — documents known coverage gaps for cross-cutting concerns, and tensor creation operators. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760962
Summary: Adds the Elementwise Math operator category from `inductor-operators.csv` to upstream torchfuzz: 88 ops (5 of which reuse upstream-registered classes). **New module:** - `operators/elementwise_math.py` — four base classes and ~70 concrete subclasses: - `UnaryElementwiseOperatorBase` — 1 input, same dtype in/out. 47 subclasses (35 float-only + 12 numeric) generated via `_make_subclass` factory. - `BoolUnaryElementwiseOperatorBase` — 1 float input, bool output. 6 subclasses (`isfinite`, `isinf`, `isnan`, etc.). - `FloatOnlyPointwiseOperatorBase(PointwiseOperator)` — inherits upstream `PointwiseOperator` (gets type promotion, scalar operands, and broadcasting for free), restricted to float dtypes. 8 subclasses (`atan2`, `copysign`, `hypot`, etc.). - `TernaryElementwiseOperatorBase` — 3 same-dtype inputs with 30% probability of broadcasting one input. 3 subclasses (`addcdiv`, `addcmul`, `lerp`). - 13 numeric binary ops subclass upstream `PointwiseOperator` directly (`divide`, `floor_divide`, `fmax`, `pow`, etc.). - 4 special-case standalone operators (`ClampMaxOperator`, `ClampMinOperator`, `HeavisideOperator`, `LdexpOperator`). **Updated:** - `operators/LIMITATIONS.md` — adds elementwise math coverage gaps section. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D106518330
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
b44bb3e to
26e218a
Compare
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
…85390) Summary: Adds the Comparison & Logical Ops and Bitwise Ops categories from `inductor-operators.csv` to upstream torchfuzz. 22 new ops across three new modules: **`operators/comparison.py`** (12 classes): - 11 binary comparison ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `greater`, `greater_equal`, `less`, `less_equal`, `not_equal`) sharing `ComparisonOperatorBase`. Picks a random numeric input dtype at `fuzz_inputs_specs` time and emits a `bool` output. 30% probability of broadcasting one input. - `WhereOperator` for `torch.where` (3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-arg `torch.where(cond)` is intentionally not modeled (data-dependent output shape). **`operators/logical.py`** (4 classes): - 3 binary logical ops (`and`/`or`/`xor`) sharing `LogicalBinaryOperatorBase`. Accepts any numeric or bool input dtype and emits `bool`. 30% probability of broadcasting one input. - Standalone `LogicalNotOperator`. **`operators/bitwise.py`** (6 classes): - 3 bitwise binary ops (`and`/`or`/`xor`) sharing `BitwiseBinaryOperatorBase` over int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input. - 2 shift ops (`left_shift`, `right_shift`) sharing `BitwiseShiftOperatorBase` over integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle `_CLAMP_SHIFT_COUNTS` enables clamping for triage noise filtering. - Standalone `BitwiseNotOperator`. Test Plan: Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D105760965
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: Command Details for Dev Infra teamRaised by workflow job |
…ntrospection-based registration, and unsigned-dtype fuzzing (#187406) Summary: This is a re-land of the following squashed [torchfuzz] diffs from the stack rooted at D106408809 (previously reverted by D108650116). Each line is the original Phabricator diff and its upstream GitHub PR: - D106408809 - #185387 - D107910279 - #186625 - D105760962 - #185388 - D106518330 - #185389 - D105760965 - #185390 - D105760963 - #185391 - D105760968 - #185392 - D105760966 - #185394 - D105760961 - #185384 - D105760964 - #185395 This change substantially expands torchfuzz operator coverage, adding ~190 operators across nine new category modules, alongside the registration and dtype-handling improvements needed to support them. ## Registration and infrastructure Operator registration is reworked from manual per-class imports + `self.register()` calls in `OperatorRegistry._register_default_operators()` to introspection-based discovery. A module-level `_OPERATOR_MODULES` list names each operator module; `_concrete_operator_classes()` discovers all concrete `Operator` subclasses in each module via `inspect.getmembers()`, filtering out re-exports (whose `__module__` doesn't match), abstract classes, and `*Base` helpers. Adding a new operator module is now a one-line change (append to `_OPERATOR_MODULES`) instead of N import lines plus N `self.register()` calls. The README "Adding New Operations" section is updated to document this flow. `fuzz_tensor` previously called `torch.randint(-100, 100, ..., dtype=dtype)` for every integer dtype, which crashed for any unsigned dtype (`uint8`/`uint16`/`uint32`/`uint64`) because `torch.randint` requires `low` to be representable in the dtype (`RuntimeError: from is out of bounds for unsigned ...`). `low` is now clamped to `0` for unsigned dtypes (detected via `torch.iinfo(dtype).min`) and kept at `-100` for signed dtypes; `high` is unchanged. Shared helpers live in `operators/_dtypes.py` (`FLOAT_DTYPES`, `is_float_dtype`, `contiguous_stride`, `random_broadcast_shape`), and `operators/LIMITATIONS.md` documents known coverage gaps per category. ## New operator categories - `operators/tensor_creation.py` (10 ops): factory ops with no inputs (`ones`, `zeros`, `full`), prototype-input ops (`ones_like`, `zeros_like`, `full_like`), tensor `.new_X()` methods (`new_ones`, `new_zeros`, `new_full`), and `arange`. Non-contiguous outputs are handled via `torch.empty_strided(...).fill_()` or a two-step copy. - `operators/elementwise_math.py` (88 ops, 5 reusing upstream-registered classes): unary same-dtype ops (47 via a `_make_subclass` factory), bool-output unary predicates (`isfinite`, `isinf`, `isnan`, ...), float-only pointwise ops subclassing upstream `PointwiseOperator` (`atan2`, `copysign`, `hypot`, ...), ternary ops (`addcdiv`, `addcmul`, `lerp`), 13 numeric binary ops subclassing `PointwiseOperator` directly, and standalone special cases (`ClampMax`, `ClampMin`, `Heaviside`, `Ldexp`). - `operators/comparison.py`, `operators/logical.py`, `operators/bitwise.py` (22 ops): 11 binary comparisons plus `torch.where` (3-arg form); 3 binary logical ops plus `logical_not`; 3 bitwise binary ops, 2 shift ops (integer-only, with a `_CLAMP_SHIFT_COUNTS` toggle), and `bitwise_not`. Comparison and logical ops emit `bool`; binary ops broadcast one input with 30% probability. - `operators/manipulation_indexing.py` (4 ops): `conj_physical` (rejects bool), `fill_` (random scalar per call), `flip` (random dim subset, covering `fliplr`/`flipud`), and `masked_fill`. `torch.nonzero` reuses upstream's existing `NonzeroOperator`. - `operators/loss_functions.py` (10 ops): elementwise same-shape losses (`mse`, `huber`, `smooth_l1`, `bce`, `bce_with_logits`, `soft_margin`, `hinge_embedding`), the three-input `margin_ranking` loss, and asymmetric classification losses (`nll`, `cross_entropy`). All use `reduction='none'` so output shapes are predictable and losses compose as interior graph nodes; domain constraints are satisfied by inline codegen transforms (e.g. `sigmoid`, `log_softmax`, typed ±1 labels), and hyperparameters are randomized per iteration. - `operators/activations.py` (18 ops, 11 new + 7 reusing upstream classes): plain unary activations reusing `UnaryElementwiseOperatorBase` (`hardswish`, `logsigmoid`, `mish`, `relu6`, `selu`), hyperparameter-stashing activations (`celu`, `softshrink`, `hardtanh`, `softplus`, `threshold`), and the per-channel-weight `prelu`. - `operators/reduction.py` (22 ops, 21 new + upstream `CumsumOperator`): cumulative single-tensor ops (`cumprod`, `logcumsumexp`), cumulative tuple `.values` ops (`cummax`, `cummin`), full/keepdim reductions (`sum`, `mean`, `prod`, `nansum`, `var`, `all`, `any`, `amax`, `amin`, `argmax`, `argmin`), dim-required tuple `.values` ops (`max`, `min`, `median`, `mode`), and standalone special cases (`count_nonzero`, `aminmax`, `var_mean`). `var`/`var_mean` use a numel>=2 helper to avoid Bessel-correction NaN. - `operators/special_functions.py` (12 ops): unary float-only `torch.special.*` ops (`digamma`, `i0`, `lgamma`, `sinc`, `bessel_j0/j1`, `bessel_y0/y1`, `i0e`), `igamma` (clamps both inputs to satisfy domain constraints, with a per-dtype `a` clamp `min`), and Chebyshev polynomial ops (`chebyshev_polynomial_t/u`) with a randomized degree. Test Plan: Registration refactor: verified that `list_operators()` returns the same set of operator names before and after the introspection-based discovery change. No operators were added or removed by the refactor itself — only the discovery mechanism changed. Unsigned dtype fix: ran `fuzz_tensor(dtype=d)` for `d in {uint8, uint16, uint32, uint64}` and confirmed it returns a tensor instead of raising, with values in `[0, 100)`. Signed `int8/16/32/64` continue to produce values in `[-100, 100)`. Operator definitions: validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions), for 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) versus "triage" (a program was generated but failed at compile or execution time — either a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved; remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D108696033 Pull Request resolved: #187406 Approved by: https://github.com/bobrenjc93
…ntrospection-based registration, and unsigned-dtype fuzzing (pytorch#187406) Summary: This is a re-land of the following squashed [torchfuzz] diffs from the stack rooted at D106408809 (previously reverted by D108650116). Each line is the original Phabricator diff and its upstream GitHub PR: - D106408809 - pytorch#185387 - D107910279 - pytorch#186625 - D105760962 - pytorch#185388 - D106518330 - pytorch#185389 - D105760965 - pytorch#185390 - D105760963 - pytorch#185391 - D105760968 - pytorch#185392 - D105760966 - pytorch#185394 - D105760961 - pytorch#185384 - D105760964 - pytorch#185395 This change substantially expands torchfuzz operator coverage, adding ~190 operators across nine new category modules, alongside the registration and dtype-handling improvements needed to support them. ## Registration and infrastructure Operator registration is reworked from manual per-class imports + `self.register()` calls in `OperatorRegistry._register_default_operators()` to introspection-based discovery. A module-level `_OPERATOR_MODULES` list names each operator module; `_concrete_operator_classes()` discovers all concrete `Operator` subclasses in each module via `inspect.getmembers()`, filtering out re-exports (whose `__module__` doesn't match), abstract classes, and `*Base` helpers. Adding a new operator module is now a one-line change (append to `_OPERATOR_MODULES`) instead of N import lines plus N `self.register()` calls. The README "Adding New Operations" section is updated to document this flow. `fuzz_tensor` previously called `torch.randint(-100, 100, ..., dtype=dtype)` for every integer dtype, which crashed for any unsigned dtype (`uint8`/`uint16`/`uint32`/`uint64`) because `torch.randint` requires `low` to be representable in the dtype (`RuntimeError: from is out of bounds for unsigned ...`). `low` is now clamped to `0` for unsigned dtypes (detected via `torch.iinfo(dtype).min`) and kept at `-100` for signed dtypes; `high` is unchanged. Shared helpers live in `operators/_dtypes.py` (`FLOAT_DTYPES`, `is_float_dtype`, `contiguous_stride`, `random_broadcast_shape`), and `operators/LIMITATIONS.md` documents known coverage gaps per category. ## New operator categories - `operators/tensor_creation.py` (10 ops): factory ops with no inputs (`ones`, `zeros`, `full`), prototype-input ops (`ones_like`, `zeros_like`, `full_like`), tensor `.new_X()` methods (`new_ones`, `new_zeros`, `new_full`), and `arange`. Non-contiguous outputs are handled via `torch.empty_strided(...).fill_()` or a two-step copy. - `operators/elementwise_math.py` (88 ops, 5 reusing upstream-registered classes): unary same-dtype ops (47 via a `_make_subclass` factory), bool-output unary predicates (`isfinite`, `isinf`, `isnan`, ...), float-only pointwise ops subclassing upstream `PointwiseOperator` (`atan2`, `copysign`, `hypot`, ...), ternary ops (`addcdiv`, `addcmul`, `lerp`), 13 numeric binary ops subclassing `PointwiseOperator` directly, and standalone special cases (`ClampMax`, `ClampMin`, `Heaviside`, `Ldexp`). - `operators/comparison.py`, `operators/logical.py`, `operators/bitwise.py` (22 ops): 11 binary comparisons plus `torch.where` (3-arg form); 3 binary logical ops plus `logical_not`; 3 bitwise binary ops, 2 shift ops (integer-only, with a `_CLAMP_SHIFT_COUNTS` toggle), and `bitwise_not`. Comparison and logical ops emit `bool`; binary ops broadcast one input with 30% probability. - `operators/manipulation_indexing.py` (4 ops): `conj_physical` (rejects bool), `fill_` (random scalar per call), `flip` (random dim subset, covering `fliplr`/`flipud`), and `masked_fill`. `torch.nonzero` reuses upstream's existing `NonzeroOperator`. - `operators/loss_functions.py` (10 ops): elementwise same-shape losses (`mse`, `huber`, `smooth_l1`, `bce`, `bce_with_logits`, `soft_margin`, `hinge_embedding`), the three-input `margin_ranking` loss, and asymmetric classification losses (`nll`, `cross_entropy`). All use `reduction='none'` so output shapes are predictable and losses compose as interior graph nodes; domain constraints are satisfied by inline codegen transforms (e.g. `sigmoid`, `log_softmax`, typed ±1 labels), and hyperparameters are randomized per iteration. - `operators/activations.py` (18 ops, 11 new + 7 reusing upstream classes): plain unary activations reusing `UnaryElementwiseOperatorBase` (`hardswish`, `logsigmoid`, `mish`, `relu6`, `selu`), hyperparameter-stashing activations (`celu`, `softshrink`, `hardtanh`, `softplus`, `threshold`), and the per-channel-weight `prelu`. - `operators/reduction.py` (22 ops, 21 new + upstream `CumsumOperator`): cumulative single-tensor ops (`cumprod`, `logcumsumexp`), cumulative tuple `.values` ops (`cummax`, `cummin`), full/keepdim reductions (`sum`, `mean`, `prod`, `nansum`, `var`, `all`, `any`, `amax`, `amin`, `argmax`, `argmin`), dim-required tuple `.values` ops (`max`, `min`, `median`, `mode`), and standalone special cases (`count_nonzero`, `aminmax`, `var_mean`). `var`/`var_mean` use a numel>=2 helper to avoid Bessel-correction NaN. - `operators/special_functions.py` (12 ops): unary float-only `torch.special.*` ops (`digamma`, `i0`, `lgamma`, `sinc`, `bessel_j0/j1`, `bessel_y0/y1`, `i0e`), `igamma` (clamps both inputs to satisfy domain constraints, with a per-dtype `a` clamp `min`), and Chebyshev polynomial ops (`chebyshev_polynomial_t/u`) with a randomized degree. Test Plan: Registration refactor: verified that `list_operators()` returns the same set of operator names before and after the introspection-based discovery change. No operators were added or removed by the refactor itself — only the discovery mechanism changed. Unsigned dtype fix: ran `fuzz_tensor(dtype=d)` for `d in {uint8, uint16, uint32, uint64}` and confirmed it returns a tensor instead of raising, with values in `[0, 100)`. Signed `int8/16/32/64` continue to produce values in `[-100, 100)`. Operator definitions: validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions), for 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) versus "triage" (a program was generated but failed at compile or execution time — either a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved; remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D108696033 Pull Request resolved: pytorch#187406 Approved by: https://github.com/bobrenjc93
…ntrospection-based registration, and unsigned-dtype fuzzing (pytorch#187406) Summary: This is a re-land of the following squashed [torchfuzz] diffs from the stack rooted at D106408809 (previously reverted by D108650116). Each line is the original Phabricator diff and its upstream GitHub PR: - D106408809 - pytorch#185387 - D107910279 - pytorch#186625 - D105760962 - pytorch#185388 - D106518330 - pytorch#185389 - D105760965 - pytorch#185390 - D105760963 - pytorch#185391 - D105760968 - pytorch#185392 - D105760966 - pytorch#185394 - D105760961 - pytorch#185384 - D105760964 - pytorch#185395 This change substantially expands torchfuzz operator coverage, adding ~190 operators across nine new category modules, alongside the registration and dtype-handling improvements needed to support them. ## Registration and infrastructure Operator registration is reworked from manual per-class imports + `self.register()` calls in `OperatorRegistry._register_default_operators()` to introspection-based discovery. A module-level `_OPERATOR_MODULES` list names each operator module; `_concrete_operator_classes()` discovers all concrete `Operator` subclasses in each module via `inspect.getmembers()`, filtering out re-exports (whose `__module__` doesn't match), abstract classes, and `*Base` helpers. Adding a new operator module is now a one-line change (append to `_OPERATOR_MODULES`) instead of N import lines plus N `self.register()` calls. The README "Adding New Operations" section is updated to document this flow. `fuzz_tensor` previously called `torch.randint(-100, 100, ..., dtype=dtype)` for every integer dtype, which crashed for any unsigned dtype (`uint8`/`uint16`/`uint32`/`uint64`) because `torch.randint` requires `low` to be representable in the dtype (`RuntimeError: from is out of bounds for unsigned ...`). `low` is now clamped to `0` for unsigned dtypes (detected via `torch.iinfo(dtype).min`) and kept at `-100` for signed dtypes; `high` is unchanged. Shared helpers live in `operators/_dtypes.py` (`FLOAT_DTYPES`, `is_float_dtype`, `contiguous_stride`, `random_broadcast_shape`), and `operators/LIMITATIONS.md` documents known coverage gaps per category. ## New operator categories - `operators/tensor_creation.py` (10 ops): factory ops with no inputs (`ones`, `zeros`, `full`), prototype-input ops (`ones_like`, `zeros_like`, `full_like`), tensor `.new_X()` methods (`new_ones`, `new_zeros`, `new_full`), and `arange`. Non-contiguous outputs are handled via `torch.empty_strided(...).fill_()` or a two-step copy. - `operators/elementwise_math.py` (88 ops, 5 reusing upstream-registered classes): unary same-dtype ops (47 via a `_make_subclass` factory), bool-output unary predicates (`isfinite`, `isinf`, `isnan`, ...), float-only pointwise ops subclassing upstream `PointwiseOperator` (`atan2`, `copysign`, `hypot`, ...), ternary ops (`addcdiv`, `addcmul`, `lerp`), 13 numeric binary ops subclassing `PointwiseOperator` directly, and standalone special cases (`ClampMax`, `ClampMin`, `Heaviside`, `Ldexp`). - `operators/comparison.py`, `operators/logical.py`, `operators/bitwise.py` (22 ops): 11 binary comparisons plus `torch.where` (3-arg form); 3 binary logical ops plus `logical_not`; 3 bitwise binary ops, 2 shift ops (integer-only, with a `_CLAMP_SHIFT_COUNTS` toggle), and `bitwise_not`. Comparison and logical ops emit `bool`; binary ops broadcast one input with 30% probability. - `operators/manipulation_indexing.py` (4 ops): `conj_physical` (rejects bool), `fill_` (random scalar per call), `flip` (random dim subset, covering `fliplr`/`flipud`), and `masked_fill`. `torch.nonzero` reuses upstream's existing `NonzeroOperator`. - `operators/loss_functions.py` (10 ops): elementwise same-shape losses (`mse`, `huber`, `smooth_l1`, `bce`, `bce_with_logits`, `soft_margin`, `hinge_embedding`), the three-input `margin_ranking` loss, and asymmetric classification losses (`nll`, `cross_entropy`). All use `reduction='none'` so output shapes are predictable and losses compose as interior graph nodes; domain constraints are satisfied by inline codegen transforms (e.g. `sigmoid`, `log_softmax`, typed ±1 labels), and hyperparameters are randomized per iteration. - `operators/activations.py` (18 ops, 11 new + 7 reusing upstream classes): plain unary activations reusing `UnaryElementwiseOperatorBase` (`hardswish`, `logsigmoid`, `mish`, `relu6`, `selu`), hyperparameter-stashing activations (`celu`, `softshrink`, `hardtanh`, `softplus`, `threshold`), and the per-channel-weight `prelu`. - `operators/reduction.py` (22 ops, 21 new + upstream `CumsumOperator`): cumulative single-tensor ops (`cumprod`, `logcumsumexp`), cumulative tuple `.values` ops (`cummax`, `cummin`), full/keepdim reductions (`sum`, `mean`, `prod`, `nansum`, `var`, `all`, `any`, `amax`, `amin`, `argmax`, `argmin`), dim-required tuple `.values` ops (`max`, `min`, `median`, `mode`), and standalone special cases (`count_nonzero`, `aminmax`, `var_mean`). `var`/`var_mean` use a numel>=2 helper to avoid Bessel-correction NaN. - `operators/special_functions.py` (12 ops): unary float-only `torch.special.*` ops (`digamma`, `i0`, `lgamma`, `sinc`, `bessel_j0/j1`, `bessel_y0/y1`, `i0e`), `igamma` (clamps both inputs to satisfy domain constraints, with a per-dtype `a` clamp `min`), and Chebyshev polynomial ops (`chebyshev_polynomial_t/u`) with a randomized degree. Test Plan: Registration refactor: verified that `list_operators()` returns the same set of operator names before and after the introspection-based discovery change. No operators were added or removed by the refactor itself — only the discovery mechanism changed. Unsigned dtype fix: ran `fuzz_tensor(dtype=d)` for `d in {uint8, uint16, uint32, uint64}` and confirmed it returns a tensor instead of raising, with values in `[0, 100)`. Signed `int8/16/32/64` continue to produce values in `[-100, 100)`. Operator definitions: validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (`--max-depth 1 --supported-ops '<op>'`) so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome in `fuzz_inputs_specs` is identified (probability `p_min`), then `N = ceil(ln(0.05) / ln(1 - p_min))` gives 95% confidence of exercising that path at least once; `N` is then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions), for 5830 total invocations across all operator categories. Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's `fuzz_inputs_specs` or `codegen`) versus "triage" (a program was generated but failed at compile or execution time — either a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved; remaining triage failures are legitimate backend compilation/execution issues. Differential Revision: D108696033 Pull Request resolved: pytorch#187406 Approved by: https://github.com/bobrenjc93
Summary:
Adds the Comparison & Logical Ops and Bitwise Ops categories from
inductor-operators.csvto upstream torchfuzz. 22 new ops across three new modules:operators/comparison.py(12 classes):eq,ne,lt,le,gt,ge,greater,greater_equal,less,less_equal,not_equal) sharingComparisonOperatorBase. Picks a random numeric input dtype atfuzz_inputs_specstime and emits abooloutput. 30% probability of broadcasting one input.WhereOperatorfortorch.where(3-arg select form only). Uniformly samples three forms: all-tensor (A), scalar-input (B), and scalar-other (C). The 1-argtorch.where(cond)is intentionally not modeled (data-dependent output shape).operators/logical.py(4 classes):and/or/xor) sharingLogicalBinaryOperatorBase. Accepts any numeric or bool input dtype and emitsbool. 30% probability of broadcasting one input.LogicalNotOperator.operators/bitwise.py(6 classes):and/or/xor) sharingBitwiseBinaryOperatorBaseover int8/16/32/64, uint8/16/32/64, and bool. 30% probability of broadcasting one input.left_shift,right_shift) sharingBitwiseShiftOperatorBaseover integer dtypes only (no bool). Shift counts are NOT clamped by default; a one-line module toggle_CLAMP_SHIFT_COUNTSenables clamping for triage noise filtering.BitwiseNotOperator.Test Plan:
Operator definitions in this commit were validated end-to-end using a downstream torchfuzz device plugin for a non-GPU architecture. A test harness ran the fuzzer across all operators in the plugin's template, testing each operator in isolation (
--max-depth 1 --supported-ops '<op>') so that failures are attributable to a single operator definition. Per-operator seed counts were derived from coupon-collector analysis: for each operator, the rarest discrete random outcome infuzz_inputs_specsis identified (probabilityp_min), thenN = ceil(ln(0.05) / ln(1 - p_min))gives 95% confidence of exercising that path at least once;Nis then doubled for margin. This produced tiered counts from 10 seeds (operators with no discrete choices) to 70 seeds (operators with complex mode/dim/dtype interactions). 5830 total invocations across all operator categories.Failures were automatically classified: "investigate" (fuzzer crashed before generating a program — likely a bug in the operator's
fuzz_inputs_specsorcodegen) vs "triage" (program was generated but failed at compile or execution time — could be a definition bug or a legitimate backend issue the fuzzer is designed to surface). Three iterative triage-and-fix rounds were completed until all operator-definition bugs were resolved. Remaining triage failures are legitimate backend compilation/execution issues.Differential Revision: D105760965