Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/183055
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 0eeb6ff with merge base e775750 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review this |
|
Claude finished @malfet's task in 1m 36s —— View job Review of PR #183055
This is a solid fix for a real correctness bug in the MPS scalar binary op path, with a clean ILP gating refactor on top. The changes are well-motivated and the test coverage targets the exact failure modes. A few observations: Scalar promotion fix (OperationUtils.mm:1152-1186) -- looks correctThe core bug is clear: when a float tensor is multiplied by a complex scalar, The fix gate ( tensor_dtype == common && c10::isIntegralType(scalar_dtype, /*includeBool=*/true) && common == kFloat;Only fires for the one case where host-side Scalar rebind (OperationUtils.mm:1271-1274) -- looks correctAfter host-promotion, the scalar tensor's Metal buffer has changed ( Cast suffix type (OperationUtils.mm:1221)Switching from ILP gating refactorClean separation of concerns: Kernel name versioning (
|
|
Starting merge as part of PR stack under #183019 |
…al (#183019) Used the metal-kernel skill to port the boolean comparison binary ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`) to native Metal kernels via the existing TensorIterator stub-dispatch path, dropping the MPSGraph-based implementations. Each stub passes `kBool` as `natural_output_dtype` (the new contract introduced in #183055) so non-bool `out=` is correctly routed through the strided castout path. Stubs also pass `ilp_threshold = 1u << 18`, matching the floating-point default — measurably faster for small/medium tensors and avoids the 2b-param dispatch cliff in MPSGraph. `torch.eq(a, b, out=c)` on M-series, default dispatcher (us/call, lower is better): | numel | torch 2.11 (MPSGraph) | this PR | speedup | |---|---|---|---| | float32, 65K | 16.6 | 12.7 | 1.3x | | float32, 262K | 111.5 | 18.6 | 6.0x | | float32, 1M | 43.1 | 42.3 | 1.0x | | float32, 16M | 601.7 | 632.6 | 0.95x | | int32, 65K | 16.3 | 3.7 | 4.4x | | int32, 262K | 16.4 | 5.2 | 3.2x | | int32, 1M | 23.3 | 24.4 | 1.0x | | int32, 16M | 613.1 | 606.2 | 1.0x | Authored with assistance from Claude. Pull Request resolved: #183019 Approved by: https://github.com/Skylion007 ghstack dependencies: #183055
Several MPS binary TensorIterator dispatcher fixes, plus tests. **Scalar promotion shortcut** restricted to lossless int-scalar→float-common only. Was building wrong kernel names (`mul_dense_scalar_float2_float` for `complex_convolution`) and rounding float scalars on the host before launch (float16 CrossEntropyLoss drift). The `cast_suffix_type` selection now uses `iter.common_dtype()` (with a `kBool` branch for comparison ops) so cast-kernel name lookups match the post-promotion template instantiation. Fixes `cosine_similarity` `mps_float16` (`half.clamp_min_(float)`). **`natural_output_dtype` contract on `exec_binary_kernel`** + new `binary_strided_castout` kernel template (with a `store_at_offs` helper). Default natural = `iter.dtype(0)`, so arithmetic ops dispatch through the existing `<DTYPEO>_<DTYPEI>` cast-kernel matrix as before. Ops whose kernel produces a fixed natural that may diverge from `iter.dtype(0)` (comparisons → `kBool`) declare it via the new parameter; the dispatcher then routes through `_strided_castout_<DTYPEO>_<DTYPEI>`, which computes at compile-time precision and runtime-casts on store. Castout is explicit opt-in via a separate `REGISTER_BINARY_CASTOUT_OP(NAME, DTYPEI, DTYPEO)` macro -- arithmetic ops don't pay binary size for unused kernels. Missing combos fail loudly via `getPipelineStateForFunc` rather than silent corruption. The contract is used by the comparison-ops migration in pytorch#183019 to fix `cdist` `mps_float32` (`linalg_vector_norm(p=0)` → `ne_outf(float, 0, float_out)`) and inductor `test_complex_from_real_imag_mps`. **`C10_METAL_ALL_TYPES_FUNCTOR` extended** to `(EnumName, EnumValue, MetalType)`. `val_at_offs` and `store_at_offs` are generated from the same X-macro instead of hand-written per-type switches. **Caller-tunable ILP threshold** via a new `ilp_threshold` parameter. Float-output default kept at 256K; non-float defaults off. `binary_dense_ilp` is `unsigned ILP`-templated and the unroll width appears in host names (`add_dense_ilp4_float_float`) so future `ilp8`/`ilp16` can coexist. Tests: new `TestBinaryIteratorConformance` (two synthetic functors -- `simple_add` and `simple_ge` -- compiled via `MetalShaderLibrary` and dispatched through the same path real ops use; `simple_ge` opts into castout). Plus `test_binary_kernels` regressions for scalar precision and in-place narrowing. Authored with assistance from Claude. Pull Request resolved: pytorch#183055 Approved by: https://github.com/Skylion007
…al (pytorch#183019) Used the metal-kernel skill to port the boolean comparison binary ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`) to native Metal kernels via the existing TensorIterator stub-dispatch path, dropping the MPSGraph-based implementations. Each stub passes `kBool` as `natural_output_dtype` (the new contract introduced in pytorch#183055) so non-bool `out=` is correctly routed through the strided castout path. Stubs also pass `ilp_threshold = 1u << 18`, matching the floating-point default — measurably faster for small/medium tensors and avoids the 2b-param dispatch cliff in MPSGraph. `torch.eq(a, b, out=c)` on M-series, default dispatcher (us/call, lower is better): | numel | torch 2.11 (MPSGraph) | this PR | speedup | |---|---|---|---| | float32, 65K | 16.6 | 12.7 | 1.3x | | float32, 262K | 111.5 | 18.6 | 6.0x | | float32, 1M | 43.1 | 42.3 | 1.0x | | float32, 16M | 601.7 | 632.6 | 0.95x | | int32, 65K | 16.3 | 3.7 | 4.4x | | int32, 262K | 16.4 | 5.2 | 3.2x | | int32, 1M | 23.3 | 24.4 | 1.0x | | int32, 16M | 613.1 | 606.2 | 1.0x | Authored with assistance from Claude. Pull Request resolved: pytorch#183019 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#183055
Several MPS binary TensorIterator dispatcher fixes, plus tests. **Scalar promotion shortcut** restricted to lossless int-scalar→float-common only. Was building wrong kernel names (`mul_dense_scalar_float2_float` for `complex_convolution`) and rounding float scalars on the host before launch (float16 CrossEntropyLoss drift). The `cast_suffix_type` selection now uses `iter.common_dtype()` (with a `kBool` branch for comparison ops) so cast-kernel name lookups match the post-promotion template instantiation. Fixes `cosine_similarity` `mps_float16` (`half.clamp_min_(float)`). **`natural_output_dtype` contract on `exec_binary_kernel`** + new `binary_strided_castout` kernel template (with a `store_at_offs` helper). Default natural = `iter.dtype(0)`, so arithmetic ops dispatch through the existing `<DTYPEO>_<DTYPEI>` cast-kernel matrix as before. Ops whose kernel produces a fixed natural that may diverge from `iter.dtype(0)` (comparisons → `kBool`) declare it via the new parameter; the dispatcher then routes through `_strided_castout_<DTYPEO>_<DTYPEI>`, which computes at compile-time precision and runtime-casts on store. Castout is explicit opt-in via a separate `REGISTER_BINARY_CASTOUT_OP(NAME, DTYPEI, DTYPEO)` macro -- arithmetic ops don't pay binary size for unused kernels. Missing combos fail loudly via `getPipelineStateForFunc` rather than silent corruption. The contract is used by the comparison-ops migration in pytorch#183019 to fix `cdist` `mps_float32` (`linalg_vector_norm(p=0)` → `ne_outf(float, 0, float_out)`) and inductor `test_complex_from_real_imag_mps`. **`C10_METAL_ALL_TYPES_FUNCTOR` extended** to `(EnumName, EnumValue, MetalType)`. `val_at_offs` and `store_at_offs` are generated from the same X-macro instead of hand-written per-type switches. **Caller-tunable ILP threshold** via a new `ilp_threshold` parameter. Float-output default kept at 256K; non-float defaults off. `binary_dense_ilp` is `unsigned ILP`-templated and the unroll width appears in host names (`add_dense_ilp4_float_float`) so future `ilp8`/`ilp16` can coexist. Tests: new `TestBinaryIteratorConformance` (two synthetic functors -- `simple_add` and `simple_ge` -- compiled via `MetalShaderLibrary` and dispatched through the same path real ops use; `simple_ge` opts into castout). Plus `test_binary_kernels` regressions for scalar precision and in-place narrowing. Authored with assistance from Claude. Pull Request resolved: pytorch#183055 Approved by: https://github.com/Skylion007
…al (pytorch#183019) Used the metal-kernel skill to port the boolean comparison binary ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`) to native Metal kernels via the existing TensorIterator stub-dispatch path, dropping the MPSGraph-based implementations. Each stub passes `kBool` as `natural_output_dtype` (the new contract introduced in pytorch#183055) so non-bool `out=` is correctly routed through the strided castout path. Stubs also pass `ilp_threshold = 1u << 18`, matching the floating-point default — measurably faster for small/medium tensors and avoids the 2b-param dispatch cliff in MPSGraph. `torch.eq(a, b, out=c)` on M-series, default dispatcher (us/call, lower is better): | numel | torch 2.11 (MPSGraph) | this PR | speedup | |---|---|---|---| | float32, 65K | 16.6 | 12.7 | 1.3x | | float32, 262K | 111.5 | 18.6 | 6.0x | | float32, 1M | 43.1 | 42.3 | 1.0x | | float32, 16M | 601.7 | 632.6 | 0.95x | | int32, 65K | 16.3 | 3.7 | 4.4x | | int32, 262K | 16.4 | 5.2 | 3.2x | | int32, 1M | 23.3 | 24.4 | 1.0x | | int32, 16M | 613.1 | 606.2 | 1.0x | Authored with assistance from Claude. Pull Request resolved: pytorch#183019 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#183055
Several MPS binary TensorIterator dispatcher fixes, plus tests. **Scalar promotion shortcut** restricted to lossless int-scalar→float-common only. Was building wrong kernel names (`mul_dense_scalar_float2_float` for `complex_convolution`) and rounding float scalars on the host before launch (float16 CrossEntropyLoss drift). The `cast_suffix_type` selection now uses `iter.common_dtype()` (with a `kBool` branch for comparison ops) so cast-kernel name lookups match the post-promotion template instantiation. Fixes `cosine_similarity` `mps_float16` (`half.clamp_min_(float)`). **`natural_output_dtype` contract on `exec_binary_kernel`** + new `binary_strided_castout` kernel template (with a `store_at_offs` helper). Default natural = `iter.dtype(0)`, so arithmetic ops dispatch through the existing `<DTYPEO>_<DTYPEI>` cast-kernel matrix as before. Ops whose kernel produces a fixed natural that may diverge from `iter.dtype(0)` (comparisons → `kBool`) declare it via the new parameter; the dispatcher then routes through `_strided_castout_<DTYPEO>_<DTYPEI>`, which computes at compile-time precision and runtime-casts on store. Castout is explicit opt-in via a separate `REGISTER_BINARY_CASTOUT_OP(NAME, DTYPEI, DTYPEO)` macro -- arithmetic ops don't pay binary size for unused kernels. Missing combos fail loudly via `getPipelineStateForFunc` rather than silent corruption. The contract is used by the comparison-ops migration in pytorch#183019 to fix `cdist` `mps_float32` (`linalg_vector_norm(p=0)` → `ne_outf(float, 0, float_out)`) and inductor `test_complex_from_real_imag_mps`. **`C10_METAL_ALL_TYPES_FUNCTOR` extended** to `(EnumName, EnumValue, MetalType)`. `val_at_offs` and `store_at_offs` are generated from the same X-macro instead of hand-written per-type switches. **Caller-tunable ILP threshold** via a new `ilp_threshold` parameter. Float-output default kept at 256K; non-float defaults off. `binary_dense_ilp` is `unsigned ILP`-templated and the unroll width appears in host names (`add_dense_ilp4_float_float`) so future `ilp8`/`ilp16` can coexist. Tests: new `TestBinaryIteratorConformance` (two synthetic functors -- `simple_add` and `simple_ge` -- compiled via `MetalShaderLibrary` and dispatched through the same path real ops use; `simple_ge` opts into castout). Plus `test_binary_kernels` regressions for scalar precision and in-place narrowing. Authored with assistance from Claude. Pull Request resolved: pytorch#183055 Approved by: https://github.com/Skylion007
…al (pytorch#183019) Used the metal-kernel skill to port the boolean comparison binary ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`) to native Metal kernels via the existing TensorIterator stub-dispatch path, dropping the MPSGraph-based implementations. Each stub passes `kBool` as `natural_output_dtype` (the new contract introduced in pytorch#183055) so non-bool `out=` is correctly routed through the strided castout path. Stubs also pass `ilp_threshold = 1u << 18`, matching the floating-point default — measurably faster for small/medium tensors and avoids the 2b-param dispatch cliff in MPSGraph. `torch.eq(a, b, out=c)` on M-series, default dispatcher (us/call, lower is better): | numel | torch 2.11 (MPSGraph) | this PR | speedup | |---|---|---|---| | float32, 65K | 16.6 | 12.7 | 1.3x | | float32, 262K | 111.5 | 18.6 | 6.0x | | float32, 1M | 43.1 | 42.3 | 1.0x | | float32, 16M | 601.7 | 632.6 | 0.95x | | int32, 65K | 16.3 | 3.7 | 4.4x | | int32, 262K | 16.4 | 5.2 | 3.2x | | int32, 1M | 23.3 | 24.4 | 1.0x | | int32, 16M | 613.1 | 606.2 | 1.0x | Authored with assistance from Claude. Pull Request resolved: pytorch#183019 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#183055
Several MPS binary TensorIterator dispatcher fixes, plus tests. **Scalar promotion shortcut** restricted to lossless int-scalar→float-common only. Was building wrong kernel names (`mul_dense_scalar_float2_float` for `complex_convolution`) and rounding float scalars on the host before launch (float16 CrossEntropyLoss drift). The `cast_suffix_type` selection now uses `iter.common_dtype()` (with a `kBool` branch for comparison ops) so cast-kernel name lookups match the post-promotion template instantiation. Fixes `cosine_similarity` `mps_float16` (`half.clamp_min_(float)`). **`natural_output_dtype` contract on `exec_binary_kernel`** + new `binary_strided_castout` kernel template (with a `store_at_offs` helper). Default natural = `iter.dtype(0)`, so arithmetic ops dispatch through the existing `<DTYPEO>_<DTYPEI>` cast-kernel matrix as before. Ops whose kernel produces a fixed natural that may diverge from `iter.dtype(0)` (comparisons → `kBool`) declare it via the new parameter; the dispatcher then routes through `_strided_castout_<DTYPEO>_<DTYPEI>`, which computes at compile-time precision and runtime-casts on store. Castout is explicit opt-in via a separate `REGISTER_BINARY_CASTOUT_OP(NAME, DTYPEI, DTYPEO)` macro -- arithmetic ops don't pay binary size for unused kernels. Missing combos fail loudly via `getPipelineStateForFunc` rather than silent corruption. The contract is used by the comparison-ops migration in pytorch#183019 to fix `cdist` `mps_float32` (`linalg_vector_norm(p=0)` → `ne_outf(float, 0, float_out)`) and inductor `test_complex_from_real_imag_mps`. **`C10_METAL_ALL_TYPES_FUNCTOR` extended** to `(EnumName, EnumValue, MetalType)`. `val_at_offs` and `store_at_offs` are generated from the same X-macro instead of hand-written per-type switches. **Caller-tunable ILP threshold** via a new `ilp_threshold` parameter. Float-output default kept at 256K; non-float defaults off. `binary_dense_ilp` is `unsigned ILP`-templated and the unroll width appears in host names (`add_dense_ilp4_float_float`) so future `ilp8`/`ilp16` can coexist. Tests: new `TestBinaryIteratorConformance` (two synthetic functors -- `simple_add` and `simple_ge` -- compiled via `MetalShaderLibrary` and dispatched through the same path real ops use; `simple_ge` opts into castout). Plus `test_binary_kernels` regressions for scalar precision and in-place narrowing. Authored with assistance from Claude. Pull Request resolved: pytorch#183055 Approved by: https://github.com/Skylion007
…al (pytorch#183019) Used the metal-kernel skill to port the boolean comparison binary ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`) to native Metal kernels via the existing TensorIterator stub-dispatch path, dropping the MPSGraph-based implementations. Each stub passes `kBool` as `natural_output_dtype` (the new contract introduced in pytorch#183055) so non-bool `out=` is correctly routed through the strided castout path. Stubs also pass `ilp_threshold = 1u << 18`, matching the floating-point default — measurably faster for small/medium tensors and avoids the 2b-param dispatch cliff in MPSGraph. `torch.eq(a, b, out=c)` on M-series, default dispatcher (us/call, lower is better): | numel | torch 2.11 (MPSGraph) | this PR | speedup | |---|---|---|---| | float32, 65K | 16.6 | 12.7 | 1.3x | | float32, 262K | 111.5 | 18.6 | 6.0x | | float32, 1M | 43.1 | 42.3 | 1.0x | | float32, 16M | 601.7 | 632.6 | 0.95x | | int32, 65K | 16.3 | 3.7 | 4.4x | | int32, 262K | 16.4 | 5.2 | 3.2x | | int32, 1M | 23.3 | 24.4 | 1.0x | | int32, 16M | 613.1 | 606.2 | 1.0x | Authored with assistance from Claude. Pull Request resolved: pytorch#183019 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#183055
Several MPS binary TensorIterator dispatcher fixes, plus tests. **Scalar promotion shortcut** restricted to lossless int-scalar→float-common only. Was building wrong kernel names (`mul_dense_scalar_float2_float` for `complex_convolution`) and rounding float scalars on the host before launch (float16 CrossEntropyLoss drift). The `cast_suffix_type` selection now uses `iter.common_dtype()` (with a `kBool` branch for comparison ops) so cast-kernel name lookups match the post-promotion template instantiation. Fixes `cosine_similarity` `mps_float16` (`half.clamp_min_(float)`). **`natural_output_dtype` contract on `exec_binary_kernel`** + new `binary_strided_castout` kernel template (with a `store_at_offs` helper). Default natural = `iter.dtype(0)`, so arithmetic ops dispatch through the existing `<DTYPEO>_<DTYPEI>` cast-kernel matrix as before. Ops whose kernel produces a fixed natural that may diverge from `iter.dtype(0)` (comparisons → `kBool`) declare it via the new parameter; the dispatcher then routes through `_strided_castout_<DTYPEO>_<DTYPEI>`, which computes at compile-time precision and runtime-casts on store. Castout is explicit opt-in via a separate `REGISTER_BINARY_CASTOUT_OP(NAME, DTYPEI, DTYPEO)` macro -- arithmetic ops don't pay binary size for unused kernels. Missing combos fail loudly via `getPipelineStateForFunc` rather than silent corruption. The contract is used by the comparison-ops migration in pytorch#183019 to fix `cdist` `mps_float32` (`linalg_vector_norm(p=0)` → `ne_outf(float, 0, float_out)`) and inductor `test_complex_from_real_imag_mps`. **`C10_METAL_ALL_TYPES_FUNCTOR` extended** to `(EnumName, EnumValue, MetalType)`. `val_at_offs` and `store_at_offs` are generated from the same X-macro instead of hand-written per-type switches. **Caller-tunable ILP threshold** via a new `ilp_threshold` parameter. Float-output default kept at 256K; non-float defaults off. `binary_dense_ilp` is `unsigned ILP`-templated and the unroll width appears in host names (`add_dense_ilp4_float_float`) so future `ilp8`/`ilp16` can coexist. Tests: new `TestBinaryIteratorConformance` (two synthetic functors -- `simple_add` and `simple_ge` -- compiled via `MetalShaderLibrary` and dispatched through the same path real ops use; `simple_ge` opts into castout). Plus `test_binary_kernels` regressions for scalar precision and in-place narrowing. Authored with assistance from Claude. Pull Request resolved: pytorch#183055 Approved by: https://github.com/Skylion007
…al (pytorch#183019) Used the metal-kernel skill to port the boolean comparison binary ops (`eq`, `ne`, `lt`, `le`, `gt`, `ge`) to native Metal kernels via the existing TensorIterator stub-dispatch path, dropping the MPSGraph-based implementations. Each stub passes `kBool` as `natural_output_dtype` (the new contract introduced in pytorch#183055) so non-bool `out=` is correctly routed through the strided castout path. Stubs also pass `ilp_threshold = 1u << 18`, matching the floating-point default — measurably faster for small/medium tensors and avoids the 2b-param dispatch cliff in MPSGraph. `torch.eq(a, b, out=c)` on M-series, default dispatcher (us/call, lower is better): | numel | torch 2.11 (MPSGraph) | this PR | speedup | |---|---|---|---| | float32, 65K | 16.6 | 12.7 | 1.3x | | float32, 262K | 111.5 | 18.6 | 6.0x | | float32, 1M | 43.1 | 42.3 | 1.0x | | float32, 16M | 601.7 | 632.6 | 0.95x | | int32, 65K | 16.3 | 3.7 | 4.4x | | int32, 262K | 16.4 | 5.2 | 3.2x | | int32, 1M | 23.3 | 24.4 | 1.0x | | int32, 16M | 613.1 | 606.2 | 1.0x | Authored with assistance from Claude. Pull Request resolved: pytorch#183019 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#183055
Stack from ghstack (oldest at bottom):
Several MPS binary TensorIterator dispatcher fixes, plus tests.
Scalar promotion shortcut restricted to lossless int-scalar→float-common only. Was building wrong kernel names (
mul_dense_scalar_float2_floatforcomplex_convolution) and rounding float scalars on the host before launch (float16 CrossEntropyLoss drift). Thecast_suffix_typeselection now usesiter.common_dtype()(with akBoolbranch for comparison ops) so cast-kernel name lookups match the post-promotion template instantiation. Fixescosine_similaritymps_float16(half.clamp_min_(float)).natural_output_dtypecontract onexec_binary_kernel+ newbinary_strided_castoutkernel template (with astore_at_offshelper). Default natural =iter.dtype(0), so arithmetic ops dispatch through the existing<DTYPEO>_<DTYPEI>cast-kernel matrix as before. Ops whose kernel produces a fixed natural that may diverge fromiter.dtype(0)(comparisons →kBool) declare it via the new parameter; the dispatcher then routes through_strided_castout_<DTYPEO>_<DTYPEI>, which computes at compile-time precision and runtime-casts on store. Castout is explicit opt-in via a separateREGISTER_BINARY_CASTOUT_OP(NAME, DTYPEI, DTYPEO)macro -- arithmetic ops don't pay binary size for unused kernels. Missing combos fail loudly viagetPipelineStateForFuncrather than silent corruption. The contract is used by the comparison-ops migration in #183019 to fixcdistmps_float32(linalg_vector_norm(p=0)→ne_outf(float, 0, float_out)) and inductortest_complex_from_real_imag_mps.C10_METAL_ALL_TYPES_FUNCTORextended to(EnumName, EnumValue, MetalType).val_at_offsandstore_at_offsare generated from the same X-macro instead of hand-written per-type switches.Caller-tunable ILP threshold via a new
ilp_thresholdparameter. Float-output default kept at 256K; non-float defaults off.binary_dense_ilpisunsigned ILP-templated and the unroll width appears in host names (add_dense_ilp4_float_float) so futureilp8/ilp16can coexist.Tests: new
TestBinaryIteratorConformance(two synthetic functors --simple_addandsimple_ge-- compiled viaMetalShaderLibraryand dispatched through the same path real ops use;simple_geopts into castout). Plustest_binary_kernelsregressions for scalar precision and in-place narrowing.Authored with assistance from Claude.