🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
ci: run the CPU half-precision jobs on torch 2.14 with re-recorded manifests (#5932)
Dmytro Mishkinf66e2a0d94e6
diff --git a/.github/workflows/pr_test_cpu.yml b/.github/workflows/pr_test_cpu.ymlindex bf69ab696..b5431a08a 100644--- a/.github/workflows/pr_test_cpu.yml+++ b/.github/workflows/pr_test_cpu.yml@@ -149,7 +149,7 @@ jobs:with:os: ubuntu-latestpython-version: '["3.11"]'- pytorch-version: '["2.9.1"]'+ pytorch-version: '["2.14.0"]'pytorch-dtype: ${{ matrix.pytorch-dtype }}known-failure-profile: cpu-${{ matrix.pytorch-dtype }}# A whole leg takes ~6m, so no single test comes near these limits. A native float16 kerneldiff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.ymlindex 424a2a075..b8e6e54c2 100644--- a/.github/workflows/scheduled_test_cpu.yml+++ b/.github/workflows/scheduled_test_cpu.yml@@ -180,7 +180,7 @@ jobs:with:os: ubuntu-latestpython-version: '["3.11"]'- pytorch-version: '["2.9.1"]'+ pytorch-version: '["2.14.0"]'pytorch-dtype: ${{ matrix.pytorch-dtype }}known-failure-profile: cpu-${{ matrix.pytorch-dtype }}# Same hang guard as the PR half-precision job (#5493).diff --git a/README.md b/README.mdindex eef8715e0..fab32fe0a 100644--- a/README.md+++ b/README.md@@ -101,11 +101,11 @@ covers CUDA or MPS half precision.| `kornia.geometry.camera` | ⚠️ | ⚠️ | 13 / 23 | Pinhole `cam2pixel`/`pixel2cam` consistency, distortion round trips, `StereoCamera` reprojection; 12 bfloat16 entries are a test-side dtype assertion || `kornia.geometry.calibration` | ⚠️ | ⚠️ | 13 / 12 | `solve_pnp_dlt` rejects half inputs (float32/float64 only); `undistort_points` misses its OpenCV reference values || `kornia.geometry.epipolar` | ⚠️ | ⚠️ | 58 / 56 | `find_fundamental`, `find_essential`, `decompose_essential_matrix`, `motion_from_essential*` and `KRt_from_projection` raise `NotImplementedError`: CPU `lu`, `eigh` and QR have no half kernels |-| `kornia.geometry.homography` | ⚠️ | ⚠️ | 11 / 16 | The DLT solvers run (SVD is cast to float32) but miss the clean-point accuracy checks |+| `kornia.geometry.homography` | ⚠️ | ⚠️ | 10 / 16 | The DLT solvers run (SVD is cast to float32) but miss the clean-point accuracy checks || `kornia.geometry.liegroup` | ⚠️ | ⚠️ | 4 / 130 | `So2`/`Se2` store complex tensors; float16 inverses are computed in complex64. PyTorch has no complex bfloat16 dtype, so most bfloat16 `So2`/`Se2` tests raise (119 entries); `So3`/`Se3` miss a few composition, point-transform and orthogonality accuracy checks || `kornia.geometry.solvers` | ⚠️ | ⚠️ | 1 / 1 | `solve_quartic` accuracy on random quartics || `kornia.geometry.subpix` | ⚠️ | ⚠️ | 14 / 12 | `ConvSoftArgmax3d` raises (CPU `avg_pool3d` has no half kernel); the rest are accuracy |-| `kornia.geometry.conversions` | ⚠️ | ⚠️ | 72 / 60 | Angle-axis, quaternion and rotation-matrix round trips lose accuracy |+| `kornia.geometry.conversions` | ⚠️ | ⚠️ | 71 / 65 | Angle-axis, quaternion and rotation-matrix round trips lose accuracy || `kornia.geometry.ransac` | ⚠️ | ⚠️ | 4 / 4 | The essential and fundamental models raise through the epipolar solvers || `kornia.geometry` (other) | ⚠️ | ⚠️ | 8 / 17 | Accuracy in boxes, depth and line utilities; bfloat16 `NamedPose` construction raises || `kornia.image` | ⚠️ | ⚠️ | 4 / 4 | `draw_convex_polygon` fill accuracy |@@ -131,7 +131,8 @@ covers CUDA or MPS half precision.Pass% = passed ÷ (passed + failed). The CPU rows are the scheduled `main` CI jobs (Linux x86_64, Python 3.11,PyTorch 2.9.1, no `--runslow`). In the half jobs, *Failed* is the manifest's entry count: CI reports those tests asstrict xfails, and it fails if any of them passes or fails differently. Tests marked `xfail` in the source are-excluded from every row. Reproduce a CPU half row in that environment with+excluded from every row. The manifests now pin PyTorch 2.14.0, so the half rows above are not reproducible from them. Verify+the current profiles on Linux x86_64, Python 3.11 and PyTorch 2.14.0 with`KORNIA_TEST_OPTIMIZER= pixi run test-module tests/ --verify-known-failures --known-failure-profile=cpu-float16`(or `cpu-bfloat16`), and the baseline with `pixi run test-f32`. `pixi run test-half` is an unseeded sweep of bothdtypes whose counts can drift slightly from the manifests. The CUDA rows are a local run, not CI (RTX 4090,diff --git a/docs/source/get-started/precision.rst b/docs/source/get-started/precision.rstindex 1339d55b3..eedcbe43b 100644--- a/docs/source/get-started/precision.rst+++ b/docs/source/get-started/precision.rst@@ -83,7 +83,7 @@ precision, so the table says nothing about those backends.* - ``kornia.geometry.homography``- ⚠️ Partial- ⚠️ Partial- - 11 / 16+ - 10 / 16- The DLT solvers run (``_torch_svd_cast`` promotes the SVD to float32) but miss the clean-point accuracychecks, including the iterated and line-based variants.* - ``kornia.geometry.liegroup``@@ -108,7 +108,7 @@ precision, so the table says nothing about those backends.* - ``kornia.geometry.conversions``- ⚠️ Partial- ⚠️ Partial- - 72 / 60+ - 71 / 65- Angle-axis, quaternion and rotation-matrix round trips lose accuracy (including ``tests/integration``).* - ``kornia.geometry.ransac``- ⚠️ Partial@@ -180,8 +180,9 @@ Eight of the CUDA float32 failures are cuDNN TF32 accuracy misses in convolution(`#4778 <https://github.com/kornia/kornia/issues/4778>`_); the other 14 are tests that assume CPU behavior(`#4779 <https://github.com/kornia/kornia/issues/4779>`_).-Reproduce a CPU half-precision row in that environment (the manifest header pins the OS, architecture, Python and-PyTorch versions) with:+The manifests now pin PyTorch 2.14.0, so the CPU half-precision rows below are not reproducible from them. Verify the+current profiles on Linux x86_64, Python 3.11 and PyTorch 2.14.0 (the manifest header pins the OS, architecture, Python+and PyTorch versions) with:.. code-block:: bashdiff --git a/testing/half_precision_xfails/cpu_bfloat16.txt b/testing/half_precision_xfails/cpu_bfloat16.txtindex 2e217b6ab..b19055c67 100644--- a/testing/half_precision_xfails/cpu_bfloat16.txt+++ b/testing/half_precision_xfails/cpu_bfloat16.txt@@ -1,7 +1,7 @@# known-failure-schema: 1# profile: cpu-bfloat16# python: 3.11-# pytorch: 2.9.1+# pytorch: 2.14.0# os: Linux# arch: x86_64# seed-scheme: sha256-nodeid-v1@@ -178,6 +178,8 @@ call builtins.AssertionError tests/geometry/test_conversions.py::TestNormalizePicall builtins.AssertionError tests/geometry/test_conversions.py::TestNormalizePixelCoordinates::test_tensor_bhw2[cpu-bfloat16]call builtins.AssertionError tests/geometry/test_conversions.py::TestQuaternionExpToLog::test_back_and_forth[cpu-bfloat16]call builtins.AssertionError tests/geometry/test_conversions.py::TestQuaternionFromEuler::test_values[cpu-bfloat16]+call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-bfloat16-batch_shape0]+call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-bfloat16-batch_shape1]call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-bfloat16-batch_shape2]call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-bfloat16-batch_shape3]call builtins.AssertionError tests/geometry/test_conversions.py::TestRotationMatrixToAngleAxis::test_rand_quaternion_gradcheck[cpu-bfloat16-1]@@ -206,14 +208,17 @@ call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomograpcall builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points_iter[cpu-bfloat16-1]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points_iter[cpu-bfloat16-2]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points_iter[cpu-bfloat16-5]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_axis_angle[cpu-bfloat16-None]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_from_to_euler_values[cpu-bfloat16]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_inverse[cpu-bfloat16-2]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_inverse[cpu-bfloat16-5]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_inverse[cpu-bfloat16-None]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_pow[cpu-bfloat16-1]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_pow[cpu-bfloat16-5]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-bfloat16-1]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-bfloat16-2]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-bfloat16-5]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-bfloat16-None]-call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternionAverage::test_single_quaternion_returns_itself[cpu-bfloat16]call builtins.NotImplementedError tests/geometry/test_ransac.py::TestRANSACEssential::test_forward_enforces_essential_constraint[cpu-bfloat16]call builtins.NotImplementedError tests/geometry/test_ransac.py::TestRANSACEssential::test_polish_enforces_essential_constraint[cpu-bfloat16]call builtins.AssertionError tests/geometry/transform/test_affine.py::TestRescale::test_downscale_values[cpu-bfloat16]@@ -226,7 +231,6 @@ call builtins.AssertionError tests/geometry/transform/test_homography_warper.py:call builtins.AssertionError tests/geometry/transform/test_homography_warper.py::TestHomographyWarper3D::test_normalize_homography_identity[cpu-bfloat16-3]call builtins.AssertionError tests/geometry/transform/test_homography_warper.py::TestHomographyWarper::test_normalize_homography_identity[cpu-bfloat16-1]call builtins.AssertionError tests/geometry/transform/test_homography_warper.py::TestHomographyWarper::test_normalize_homography_identity[cpu-bfloat16-3]-call builtins.AssertionError tests/geometry/transform/test_homography_warper.py::TestHomographyWarper::test_translation[cpu-bfloat16-shape0]call builtins.AssertionError tests/geometry/transform/test_homography_warper.py::TestHomographyWarper::test_translation[cpu-bfloat16-shape1]call builtins.AssertionError tests/geometry/transform/test_homography_warper.py::TestHomographyWarper::test_translation[cpu-bfloat16-shape3]call builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestGetPerspectiveTransform::test_back_and_forth[cpu-bfloat16]@@ -238,6 +242,7 @@ call builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestRotatcall builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestRotationMatrix2d::test_rotation_90deg_and_scale[cpu-bfloat16-1]call builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestRotationMatrix2d::test_rotation_90deg_and_scale[cpu-bfloat16-2]call builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestRotationMatrix2d::test_rotation_90deg_and_scale[cpu-bfloat16-5]+call builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestWarpAffine::test_rotation_inverse[cpu-bfloat16]call builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestWarpPerspective::test_convention_normalize_invert_equivalence[cpu-bfloat16]call builtins.AssertionError tests/geometry/transform/test_imgwarp.py::TestWarpPerspective::test_rotation_inverse[cpu-bfloat16]call builtins.AssertionError tests/geometry/transform/test_imgwarp3d.py::TestGetRotationMatrix3d::test_rot90x[cpu-bfloat16]diff --git a/testing/half_precision_xfails/cpu_float16.txt b/testing/half_precision_xfails/cpu_float16.txtindex b62e6013d..d299e2a78 100644--- a/testing/half_precision_xfails/cpu_float16.txt+++ b/testing/half_precision_xfails/cpu_float16.txt@@ -1,7 +1,7 @@# known-failure-schema: 1# profile: cpu-float16# python: 3.11-# pytorch: 2.9.1+# pytorch: 2.14.0# os: Linux# arch: x86_64# seed-scheme: sha256-nodeid-v1@@ -168,8 +168,6 @@ call builtins.AssertionError tests/geometry/test_conversions.py::TestProjectPoincall builtins.AssertionError tests/geometry/test_conversions.py::TestQuaternionExpToLog::test_back_and_forth[cpu-float16]call builtins.AssertionError tests/geometry/test_conversions.py::TestQuaternionFromEuler::test_values[cpu-float16]call builtins.AssertionError tests/geometry/test_conversions.py::TestQuaternionLogToExp::test_back_and_forth[cpu-float16]-call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-float16-batch_shape0]-call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-float16-batch_shape1]call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-float16-batch_shape2]call builtins.AssertionError tests/geometry/test_conversions.py::TestRadDegConversions::test_deg2rad[cpu-float16-batch_shape3]call builtins.AssertionError tests/geometry/test_conversions.py::TestRotationMatrixToAngleAxis::test_rand_quaternion_gradcheck[cpu-float16-5]@@ -179,26 +177,26 @@ call builtins.AssertionError tests/geometry/test_depth.py::TestDepthToNormals::tcall builtins.AssertionError tests/geometry/test_depth.py::TestWarpFrameDepth::test_translation_normalized[cpu-float16]call builtins.AssertionError tests/geometry/test_depth_warper.py::TestDepthWarper::test_compute_subpixel_step[cpu-float16-1]call builtins.AssertionError tests/geometry/test_depth_warper.py::TestDepthWarper::test_compute_subpixel_step[cpu-float16-2]-call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLT::test_clean_points_lu[cpu-float16-1]-call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLT::test_clean_points_lu[cpu-float16-5]-call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLT::test_clean_points_svd[cpu-float16-5]+call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLT::test_clean_points_lu[cpu-float16-2]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLTIter::test_clean_points[cpu-float16-1]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLTIter::test_clean_points[cpu-float16-2]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLTIter::test_dirty_points_and_gradcheck[cpu-float16-1]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyDLTIter::test_dirty_points_and_gradcheck[cpu-float16-2]+call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points[cpu-float16-1]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points[cpu-float16-2]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points[cpu-float16-5]+call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points_iter[cpu-float16-1]call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points_iter[cpu-float16-2]-call builtins.AssertionError tests/geometry/test_homography.py::TestFindHomographyFromLinesDLT::test_clean_points_iter[cpu-float16-5]-call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_axis_angle[cpu-float16-1]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_axis_angle[cpu-float16-5]-call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_axis_angle[cpu-float16-None]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_from_to_euler_values[cpu-float16]-call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_inverse[cpu-float16-2]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_inverse[cpu-float16-1]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_inverse[cpu-float16-5]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_pow[cpu-float16-5]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-float16-1]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-float16-2]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-float16-5]call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternion::test_to_axis_angle[cpu-float16-None]+call builtins.AssertionError tests/geometry/test_quaternion.py::TestQuaternionAverage::test_single_quaternion_returns_itself[cpu-float16]call builtins.NotImplementedError tests/geometry/test_ransac.py::TestRANSACEssential::test_forward_enforces_essential_constraint[cpu-float16]call builtins.NotImplementedError tests/geometry/test_ransac.py::TestRANSACEssential::test_polish_enforces_essential_constraint[cpu-float16]call builtins.AssertionError tests/geometry/transform/test_affine.py::TestRotate::test_angle90[cpu-float16]diff --git a/tests/test_half_precision_ci.py b/tests/test_half_precision_ci.pyindex d29094ffc..b906617be 100644--- a/tests/test_half_precision_ci.py+++ b/tests/test_half_precision_ci.py@@ -48,7 +48,7 @@ pytest_plugins = ["pytester"]def _environment(**overrides: str) -> ManifestEnvironment:values = {"python": "3.11",- "pytorch": "2.9.1",+ "pytorch": "2.14.0","os": "Linux","arch": "x86_64","pytest": "9.0.3",