Skip to content

Register dpnp as a new array API namespace to test against - #32460

Merged
ogrisel merged 29 commits into
scikit-learn:mainfrom
ogrisel:array-api-dpnp
Apr 29, 2026
Merged

ogrisel merged 29 commits into
scikit-learn:mainfrom
ogrisel:array-api-dpnp

Conversation

@ogrisel

@ogrisel ogrisel commented Oct 9, 2025 •

Copy link
Copy Markdown
Member

Here is tentative PR to experiment with array API support in dpnp: Intel's hardware optimized implementation of the array API spec with both CPU and GPU support.

Note that when installing dpnp from pip you need to also set the OCL_ICD_FILENAMES env name to point to the location of the "libintelocl.so" file:

export OCL_ICD_FILENAMES="$(find $(python -c 'import sys; print(sys.prefix)') -type f -name 'libintelocl.so' 2>/dev/null | head -n 1)"

EDIT: I can now test this PR locally on a machine with an Intel Core Ultra X7 chipset that includes an integrated Arc B390 GPU.

I took the opportunity to update our test harness for PyTorch with the XPU backend because it runs on the same hardware as DPNP.

Status

TODO in follow-up PRs

  • Find a way to skip float64 test for Intel GPUs that only support float32 precision.
  • We probably need to register a dedicated self-hosted Intel GPU CI runner if we want the Intel GPU tests to be easy to run by anybody.
  • There are a few float64 failures to investigate (1 with DPNP and 18 with PyTorch XPU, but many are related)
  • We will also need to update the doc to point users to the relevant installation instructions.

@github-actions

github-actions Bot commented Oct 9, 2025 •

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 2ee8d70. Link to the linter CI: here

@ogrisel

ogrisel commented Oct 10, 2025 •

Copy link
Copy Markdown
Member Author

BTW, if anybody with access to a laptop with an integrated Intel GPU, it would be great if you could report any failure when running the following command on this branch:

pytest -vlk "dpnp and array_api"

after having installed dpnp in your Python env (either from pip or conda both with a dedicated channel / index for each of them).

Note that it is possible to inspect if an Intel GPU can be discovered by your Python env using the dpctl package (which is a dependency of dpnp).

import dpctl
dpctl.get_devices(device_type="gpu")

If you installed those packages from pip, you probably need to manually set OCL_ICD_FILENAMES env name to point to the location of the "libintelocl.so" installed somewhere in your venv for the above to work.

@jeremiedbb

jeremiedbb commented Oct 10, 2025 •

Copy link
Copy Markdown
Member

On my laptop:

  • every cpu test passes but 1: test_cross_val_predict_array_api_compliance[dpnp-cpu-float32-3-Ridge]. The failure is a floating point comparison error just above the tol
    E       AssertionError: 
    E       Not equal to tolerance rtol=0.0001, atol=1.19209e-05
    E       
    E       Mismatched elements: 1 / 1000 (0.1%)
    E       Max absolute difference among violations: 2.1278858e-05
    E       Max relative difference among violations: 0.00033773
    E        ACTUAL: array([-5.430755e+01,  4.236145e+01, -1.937310e+01, -7.685248e+01,
    E              -5.676701e+01,  4.853618e+01, -7.084657e+01,  4.519698e+01,
    E               4.783569e+01, -3.218875e+00, -1.372967e+01,  6.413725e+01,...
    E        DESIRED: array([-5.430753e+01,  4.236142e+01, -1.937309e+01, -7.685242e+01,
    E              -5.676698e+01,  4.853615e+01, -7.084656e+01,  4.519695e+01,
    E               4.783565e+01, -3.218870e+00, -1.372965e+01,  6.413721e+01,...
    

 ```

  • gpu tests are skipped. I did set the environment variable. Fro me the path is /home/jeremie/miniforge3/envs/dev/lib/libintelocl.so but the output of dpctl.get_devices(device_type="gpu") is empty.
lscpu
Architecture :                              x86_64
  Mode(s) opératoire(s) des processeurs :   32-bit, 64-bit
  Address sizes:                            39 bits physical, 48 bits virtual
  Boutisme :                                Little Endian
Processeur(s) :                             16
  Liste de processeur(s) en ligne :         0-15
Identifiant constructeur :                  GenuineIntel
  Nom de modèle :                           13th Gen Intel(R) Core(TM) i7-1360P
    Famille de processeur :                 6
    Modèle :                                186
    Thread(s) par cœur :                    2
    Cœur(s) par socket :                    12
    Socket(s) :                             1
    Révision :                              2
    Vitesse maximale du processeur en MHz : 5000,0000
    Vitesse minimale du processeur en MHz : 400,0000
    BogoMIPS :                              5222.40
    Drapaux :                               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe sy
                                            scall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc
                                            _known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic mo
                                            vbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibr
                                            s_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap cl
                                            flushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts
                                             hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movd
                                            ir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
Virtualization features:                    
  Virtualisation :                          VT-x
Caches (sum of all):                        
  L1d:                                      448 KiB (12 instances)
  L1i:                                      640 KiB (12 instances)
  L2:                                       9 MiB (6 instances)
  L3:                                       18 MiB (1 instance)
NUMA:                                       
  Nœud(s) NUMA :                            1
  Nœud NUMA 0 de processeur(s) :            0-15
Vulnerabilities:                            
  Gather data sampling:                     Not affected
  Itlb multihit:                            Not affected
  L1tf:                                     Not affected
  Mds:                                      Not affected
  Meltdown:                                 Not affected
  Mmio stale data:                          Not affected
  Reg file data sampling:                   Mitigation; Clear Register File
  Retbleed:                                 Not affected
  Spec rstack overflow:                     Not affected
  Spec store bypass:                        Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:                               Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:                               Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
  Srbds:                                    Not affected
  Tsx async abort:                          Not affected
lspci
0000:00:00.0 Host bridge: Intel Corporation Device a707
0000:00:02.0 VGA compatible controller: Intel Corporation Device a7a0 (rev 04)
0000:00:04.0 Signal processing controller: Intel Corporation Device a71d
0000:00:05.0 Multimedia controller: Intel Corporation Device a75d
0000:00:06.0 System peripheral: Intel Corporation Device 09ab
0000:00:07.0 PCI bridge: Intel Corporation Device a76e
0000:00:07.2 PCI bridge: Intel Corporation Device a72f
0000:00:08.0 System peripheral: Intel Corporation Device a74f
0000:00:0a.0 Signal processing controller: Intel Corporation Device a77d (rev 01)
0000:00:0d.0 USB controller: Intel Corporation Device a71e
0000:00:0d.2 USB controller: Intel Corporation Device a73e
0000:00:0d.3 USB controller: Intel Corporation Device a76d
0000:00:0e.0 RAID bus controller: Intel Corporation Device a77f
0000:00:12.0 Serial controller: Intel Corporation Device 51fc (rev 01)
0000:00:14.0 USB controller: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller (rev 01)
0000:00:14.2 RAM memory: Intel Corporation Alder Lake PCH Shared SRAM (rev 01)
0000:00:14.3 Network controller: Intel Corporation Device 51f1 (rev 01)
0000:00:15.0 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 (rev 01)
0000:00:15.1 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #1 (rev 01)
0000:00:16.0 Communication controller: Intel Corporation Alder Lake PCH HECI Controller (rev 01)
0000:00:1e.0 Communication controller: Intel Corporation Alder Lake PCH UART #0 (rev 01)
0000:00:1e.3 Serial bus controller: Intel Corporation Device 51ab (rev 01)
0000:00:1f.0 ISA bridge: Intel Corporation Device 519d (rev 01)
0000:00:1f.3 Multimedia audio controller: Intel Corporation Device 51ca (rev 01)
0000:00:1f.4 SMBus: Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01)
0000:00:1f.5 Serial bus controller: Intel Corporation Alder Lake-P PCH SPI Controller (rev 01)
10000:e0:06.0 PCI bridge: Intel Corporation Device a74d
10000:e1:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller PM9A1/PM9A3/980PRO

@ogrisel

ogrisel commented Oct 10, 2025

Copy link
Copy Markdown
Member Author

@jeremiedbb thanks for testing. Could you please edit your comment to add the output of lscpu and lspci or similar?

@ogrisel

ogrisel commented Oct 10, 2025

Copy link
Copy Markdown
Member Author

Maybe you could try in another conda env specifically created to included all the dependencies for the Intel Distribution for Python.

@jeremiedbb

Copy link
Copy Markdown
Member

Could you please edit your comment to add the output of lscpu and lspci or similar?

I edited my comment

@lesteve

lesteve commented Oct 10, 2025 •

Copy link
Copy Markdown
Member

Does not seem to detect my GPU either. python -c 'import dpctl; print(dpctl.get_devices(device_type="gpu"))' is the empty list.

I tried both installing dpnp and the Intel distribution for Python (with mamba), same result.

lspci
00:00.0 Host bridge: Intel Corporation Raptor Lake-P/U 2p+8e cores Host Bridge/DRAM Controller (rev 01)
00:02.0 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:04.0 Signal processing controller: Intel Corporation Raptor Lake Dynamic Platform and Thermal Framework Processor Participant (rev 01)
00:06.0 PCI bridge: Intel Corporation Raptor Lake PCIe 4.0 Graphics Port (rev 01)
00:07.0 PCI bridge: Intel Corporation Raptor Lake-P Thunderbolt 4 PCI Express Root Port #0 (rev 01)
00:07.2 PCI bridge: Intel Corporation Raptor Lake-P Thunderbolt 4 PCI Express Root Port #2 (rev 01)
00:08.0 System peripheral: Intel Corporation GNA Scoring Accelerator module (rev 01)
00:0a.0 Signal processing controller: Intel Corporation Raptor Lake Crashlog and Telemetry (rev 01)
00:0d.0 USB controller: Intel Corporation Raptor Lake-P Thunderbolt 4 USB Controller (rev 01)
00:0d.2 USB controller: Intel Corporation Raptor Lake-P Thunderbolt 4 NHI #0 (rev 01)
00:0d.3 USB controller: Intel Corporation Raptor Lake-P Thunderbolt 4 NHI #1 (rev 01)
00:14.0 USB controller: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller (rev 01)
00:14.2 RAM memory: Intel Corporation Alder Lake PCH Shared SRAM (rev 01)
00:14.3 Network controller: Intel Corporation Raptor Lake PCH CNVi WiFi (rev 01)
00:15.0 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 (rev 01)
00:16.0 Communication controller: Intel Corporation Alder Lake PCH HECI Controller (rev 01)
00:1f.0 ISA bridge: Intel Corporation Raptor Lake LPC/eSPI Controller (rev 01)
00:1f.3 Audio device: Intel Corporation Raptor Lake-P/U/H cAVS (rev 01)
00:1f.4 SMBus: Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01)
00:1f.5 Serial bus controller: Intel Corporation Alder Lake-P PCH SPI Controller (rev 01)
04:00.0 Non-Volatile memory controller: Sandisk Corp WD PC SN810 / Black SN850 NVMe SSD (rev 01)
lscpu
Architecture:                x86_64
  CPU op-mode(s):            32-bit, 64-bit
  Address sizes:             39 bits physical, 48 bits virtual
  Byte Order:                Little Endian
CPU(s):                      12
  On-line CPU(s) list:       0-11
Vendor ID:                   GenuineIntel
  Model name:                13th Gen Intel(R) Core(TM) i7-1355U
    CPU family:              6
    Model:                   186
    Thread(s) per core:      2
    Core(s) per socket:      10
    Socket(s):               1
    Stepping:                3
    CPU(s) scaling MHz:      21%
    CPU max MHz:             5000.0000
    CPU min MHz:             400.0000
    BogoMIPS:                5222.40
    Flags:                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology
                              nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand 
                             lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt 
                             sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid mo
                             vdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
Virtualization features:     
  Virtualization:            VT-x
Caches (sum of all):         
  L1d:                       352 KiB (10 instances)
  L1i:                       576 KiB (10 instances)
  L2:                        6.5 MiB (4 instances)
  L3:                        12 MiB (1 instance)
NUMA:                        
  NUMA node(s):              1
  NUMA node0 CPU(s):         0-11
Vulnerabilities:             
  Gather data sampling:      Not affected
  Ghostwrite:                Not affected
  Indirect target selection: Not affected
  Itlb multihit:             Not affected
  L1tf:                      Not affected
  Mds:                       Not affected
  Meltdown:                  Not affected
  Mmio stale data:           Not affected
  Old microcode:             Not affected
  Reg file data sampling:    Mitigation; Clear Register File
  Retbleed:                  Not affected
  Spec rstack overflow:      Not affected
  Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:                Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:                Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
  Srbds:                     Not affected
  Tsa:                       Not affected
  Tsx async abort:           Not affected
  Vmscape:                   Mitigation; IBPB before exit to userspace

@ogrisel ogrisel changed the title Register dpnp as array API namespace to test against Register dpnp as a new array API namespace to test against Oct 10, 2025
@jeremiedbb

jeremiedbb commented Oct 10, 2025 •

Copy link
Copy Markdown
Member

Maybe you could try in another conda env specifically created to included all the dependencies for the Intel Distribution for Python.

same result :/

@ogrisel

ogrisel commented Oct 10, 2025 •

Copy link
Copy Markdown
Member Author

@ogrisel

ogrisel commented Oct 10, 2025

Copy link
Copy Markdown
Member Author

We might want to bump atol (and/or rtol?) by a factor of 10 on float32 platforms for all array API conformance tests as we are experiencing similar failures with Apple MPS devices in #27961.

@OmarManzoor

Copy link
Copy Markdown
Contributor

Should we increase _atol_for_type(dtype_or_dtype_name) for all cases as in the other PR it just seems to be an issue with MPS. The same for rtol. Should we introduce _rtol_for_type(dtype_or_dtype_name) and adjust it generically?

@ogrisel

ogrisel commented Oct 13, 2025

Copy link
Copy Markdown
Member Author

Note for later, the following command gives more precise info about the identifier of the graphics card controller:

lspci -nn |grep  -Ei 'VGA|DISPLAY'

The output of which can be looked up in the following table:

https://dgpu-docs.intel.com/devices/hardware-table.html

@vlad-perevezentsev

Copy link
Copy Markdown

@ogrisel Thanks for your interest in integrating dpnp into scikit-learn`s array API tests.
I ran your changes on several Intel GPUs to verify the behavior across different hardware

Env setup
$ python3 -m venv scikit-dpnp-env
$ source scikit-dpnp-env/bin/activate
$ pip install wheel numpy scipy cython meson-python ninja dpnp pytest

$ pip install --editable . \
     --verbose --no-build-isolation \
     --config-settings editable-verbose=true

$ export OCL_ICD_FILENAMES="$(find $(python -c 'import sys; print(sys.prefix)') -type f -name 'libintelocl.so' 2>/dev/null | head -n 1)"

$ export SCIPY_ARRAY_API=1
$ pytest -vlk "dpnp and array_api"
Env info
$ pip list
Package            Version  Editable project location
------------------ -------- -----------------------------------------
Cython             3.2.0
dpcpp-cpp-rt       2025.3.1
dpctl              0.21.0
dpnp               0.19.0
iniconfig          2.3.0
intel-cmplr-lib-rt 2025.3.1
intel-cmplr-lib-ur 2025.3.1
intel-cmplr-lic-rt 2025.3.1
intel-opencl-rt    2025.3.1
intel-openmp       2025.3.1
intel-sycl-rt      2025.3.1
joblib             1.5.2
meson              1.9.1
meson-python       0.18.0
mkl                2025.3.0
ninja              1.13.0
numpy              2.3.4
onemkl-license     2025.3.0
onemkl-sycl-blas   2025.3.0
onemkl-sycl-dft    2025.3.0
onemkl-sycl-lapack 2025.3.0
onemkl-sycl-rng    2025.3.0
onemkl-sycl-stats  2025.3.0
onemkl-sycl-vm     2025.3.0
packaging          25.0
pip                25.0.1
pluggy             1.6.0
Pygments           2.19.2
pyproject-metadata 0.9.1
pytest             8.4.2
scikit-learn       1.8.dev0 /localdisk/work/vperevez/work/scikit-learn
scipy              1.16.3
tbb                2022.3.0
tcmlib             1.4.1
threadpoolctl      3.6.0
umf                1.0.2
wheel              0.45.1

On Alder Lake-S GT1

python -m dpctl -f
Platform  0 ::
    Name        Intel(R) oneAPI Unified Runtime over Level-Zero
    Version     1.6
    Vendor      Intel(R) Corporation
    Backend     ext_oneapi_level_zero
    Num Devices 1
      # 0
        Name                Intel(R) UHD Graphics 770
        Version             1.6.33578+15
        Filter string       level_zero:gpu:0
Platform  1 ::
    Name        Intel(R) OpenCL
    Version     OpenCL 3.0 LINUX
    Vendor      Intel(R) Corporation
    Backend     opencl
    Num Devices 1
      # 0
        Name                12th Gen Intel(R) Core(TM) i9-12900
        Version             2025.20.10.0.23_160000
        Filter string       opencl:cpu:0
Platform  2 ::
    Name        Intel(R) OpenCL Graphics
    Version     OpenCL 3.0
    Vendor      Intel(R) Corporation
    Backend     opencl
    Num Devices 1
      # 0
        Name                Intel(R) UHD Graphics 770
        Version             25.18.33578
        Filter string       opencl:gpu:0

On Intel Data Center GPU Max 1100 (PVC)

python -m dpctl -f
Platform  0 ::
    Name        Intel(R) oneAPI Unified Runtime over Level-Zero
    Version     1.6
    Vendor      Intel(R) Corporation
    Backend     ext_oneapi_level_zero
    Num Devices 1
      # 0
        Name                Intel(R) Data Center GPU Max 1100
        Version             1.6.33578+15
        Filter string       level_zero:gpu:0
Platform  1 ::
    Name        Intel(R) OpenCL
    Version     OpenCL 3.0 LINUX
    Vendor      Intel(R) Corporation
    Backend     opencl
    Num Devices 1
      # 0
        Name                Intel(R) Xeon(R) Platinum 8480+
        Version             2025.20.10.0.23_160000
        Filter string       opencl:cpu:0
Platform  2 ::
    Name        Intel(R) OpenCL Graphics
    Version     OpenCL 3.0
    Vendor      Intel(R) Corporation
    Backend     opencl
    Num Devices 1
      # 0
        Name                Intel(R) Data Center GPU Max 1100
        Version             25.18.33578
        Filter string       opencl:gpu:0

Integrated GPU Alder Lake-S GT1 (UHD Graphics)

222 failed, 1279 passed, 1 skipped, 41724 deselected, 217 warnings

Most of the failures were caused by

ValueError: Device Intel(R) UHD Graphics 770 does not provide native support for double-precision floating point type.

This is expected because most integrated Intel GPUs (UHD Graphics, Iris Xe, Alder Lake. ..) lack native double-precision floating point (float64) support.
Newer integrated GPUs such as Meteor Lake include FP64 hardware support so this is hardware-specific.
Ideally, float64 testing should be conditionally enabled based on the runtime property device.has_aspect_fp64

As an experiment, I tried disabling float64 testing for most GPU cases with a small changes to _array_api.py:

--- a/sklearn/utils/_array_api.py
+++ b/sklearn/utils/_array_api.py
@@ -93,9 +93,13 @@ def yield_namespace_device_dtype_combinations(include_numpy_namespaces=True):

         elif array_namespace == "dpnp":
             # XXX: add "accelerator" device type?
-            for device, dtype in itertools.product(
-                ("cpu", "gpu"), ("float64", "float32")
-            ):
+            # TODO: check if device supports FP64
+            # Now check only float32 for Intel GPUs
+            for device, dtype in [
+                ("cpu", "float64"),
+                ("cpu", "float32"),
+                ("gpu", "float32"),
+            ]:
                 yield array_namespace, device, dtype

         elif array_namespace == "array_api_strict":
@@ -600,6 +604,11 @@ def _max_precision_float_dtype(xp, device):
         "mps"
     ):  # pragma: no cover
         return xp.float32
+    if _is_xp_namespace(xp, "dpnp"):
+        # TODO: check if device supports FP64
+        # Now return float32 for Intel GPUs
+        if "gpu" in str(device):
+            return xp.float32
     return xp.float64

After this change:

58 failed, 1068 passed, 1 skipped, 41724 deselected, 187 warnings
short test summary info

FAILED sklearn/decomposition/tests/test_pca.py::test_pca_array_api_compliance[PCA(n_components=2,power_iteration_normalizer='QR',random_state=0,svd_solver='randomized')-check_array_api_input_and_values-dpnp-cpu-float64] - ValueError: Device Intel(R) UHD Graphics 770 does not provide native support for double-precision floating point type.
FAILED sklearn/decomposition/tests/test_pca.py::test_pca_array_api_compliance[PCA(n_components=2,power_iteration_normalizer='QR',random_state=0,svd_solver='randomized')-check_array_api_get_precision-dpnp-cpu-float64] - ValueError: Device Intel(R) UHD Graphics 770 does not provide native support for double-precision floating point type.
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[Ridge(solver='svd')-check_array_api_input_and_values-dpnp-cpu-float64] - AssertionError
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[Ridge(solver='svd')-check_array_api_attributes-dpnp-cpu-float64] - AssertionError: assert dtype('float32') == dtype('float64')
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[RidgeClassifier(solver='svd')-check_array_api_input_and_values-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[RidgeClassifier(solver='svd')-check_array_api_attributes-dpnp-cpu-float64] - AssertionError: assert dtype('float32') == dtype('float64')
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[RidgeCV()-check_array_api_input_and_values-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[RidgeCV()-check_array_api_attributes-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[RidgeCV()-check_array_api_attributes-dpnp-cpu-float32] - AssertionError:
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[RidgeClassifierCV()-check_array_api_input_and_values-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/linear_model/tests/test_ridge.py::test_ridge_array_api_compliance[RidgeClassifierCV()-check_array_api_attributes-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/metrics/tests/test_common.py::test_array_api_compliance[cosine_distances-check_array_api_metric_pairwise-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/metrics/tests/test_pairwise.py::test_pairwise_distances_array_api[cosine-dpnp-cpu-float64] - AssertionError: assert dtype('float32') == dtype('float64')
FAILED sklearn/metrics/tests/test_pairwise.py::test_pairwise_parallel_array_api[pairwise_kernels-callable_rbf_kernel-kwds3-dpnp-cpu-float64] - ValueError: Device Intel(R) UHD Graphics 770 does not provide native support for double-precision floating point type.
FAILED sklearn/metrics/tests/test_pairwise.py::test_pairwise_parallel_array_api[pairwise_kernels-callable_rbf_kernel-kwds3-dpnp-cpu-float32] - ValueError: Execution queue is not compatible with allocation queues
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-full-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-full-random_from_data] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-tied-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-tied-random_from_data] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-diag-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-diag-random_from_data] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-spherical-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[False-dpnp-cpu-float64-spherical-random_from_data] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-full-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-full-random_from_data] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-tied-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-tied-random_from_data] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-diag-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-diag-random_from_data] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-spherical-random] - AssertionError:
FAILED sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_array_api_compliance[True-dpnp-cpu-float64-spherical-random_from_data] - AssertionError:
FAILED sklearn/model_selection/tests/test_validation.py::test_cross_val_predict_array_api_compliance[dpnp-cpu-float64-None-Ridge] - AssertionError:
FAILED sklearn/model_selection/tests/test_validation.py::test_cross_val_predict_array_api_compliance[dpnp-cpu-float64-3-Ridge] - AssertionError:
FAILED sklearn/model_selection/tests/test_validation.py::test_cross_val_predict_array_api_compliance[dpnp-cpu-float64-5-Ridge] - AssertionError:
FAILED sklearn/preprocessing/tests/test_data.py::test_preprocessing_array_api_compliance[KernelCenterer()-check_array_api_input_and_values-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_compliance[dpnp-cpu-float64-False-False] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_compliance[dpnp-cpu-float64-False-True] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_compliance[dpnp-cpu-float64-True-False] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_compliance[dpnp-cpu-float64-True-True] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_with_str_y_estimator_not_prefit[dpnp-cpu-float64-False-False] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_with_str_y_estimator_not_prefit[dpnp-cpu-float64-False-True] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_with_str_y_estimator_not_prefit[dpnp-cpu-float64-True-False] - AssertionError:
FAILED sklearn/tests/test_calibration.py::test_temperature_scaling_array_api_with_str_y_estimator_not_prefit[dpnp-cpu-float64-True-True] - AssertionError:
FAILED sklearn/tests/test_common.py::test_estimators[KernelCenterer()-check_array_api_input(array_namespace=dpnp,dtype_name=float64,device=cpu)] - AssertionError
FAILED sklearn/tests/test_common.py::test_estimators[MinMaxScaler()-check_array_api_input(array_namespace=dpnp,dtype_name=float64,device=cpu)] - AssertionError
FAILED sklearn/tests/test_common.py::test_estimators[Normalizer()-check_array_api_input(array_namespace=dpnp,dtype_name=float64,device=cpu)] - AssertionError
FAILED sklearn/tests/test_common.py::test_estimators[Ridge()-check_array_api_input(array_namespace=dpnp,dtype_name=float64,device=cpu)] - AssertionError
FAILED sklearn/tests/test_common.py::test_estimators[StandardScaler()-check_array_api_input(array_namespace=dpnp,dtype_name=float32,device=gpu)] - AssertionError
FAILED sklearn/tests/test_naive_bayes.py::test_gnb_array_api_compliance[dpnp-cpu-float64-False-False] - AssertionError:
FAILED sklearn/tests/test_naive_bayes.py::test_gnb_array_api_compliance[dpnp-cpu-float64-False-True] - AssertionError:
FAILED sklearn/tests/test_naive_bayes.py::test_gnb_array_api_compliance[dpnp-cpu-float64-True-False] - AssertionError:
FAILED sklearn/tests/test_naive_bayes.py::test_gnb_array_api_compliance[dpnp-cpu-float64-True-True] - AssertionError:
FAILED sklearn/utils/tests/test_array_api.py::test_max_precision_float_dtype[dpnp-gpu-float32] - AssertionError: assert <class 'numpy.float32'> == <class 'numpy.float64'>
FAILED sklearn/utils/tests/test_array_api.py::test_logsumexp_like_scipy_logsumexp[0-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/utils/tests/test_array_api.py::test_logsumexp_like_scipy_logsumexp[1-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/utils/tests/test_array_api.py::test_logsumexp_like_scipy_logsumexp[None-dpnp-cpu-float64] - AssertionError:
FAILED sklearn/utils/tests/test_extmath.py::test_randomized_svd_array_api_compliance[dpnp-cpu-float64] - ValueError: Device Intel(R) UHD Graphics 770 does not provide native support for double-precision floating point type.
FAILED sklearn/utils/tests/test_extmath.py::test_randomized_range_finder_array_api_compliance[dpnp-cpu-float64] - ValueError: Device Intel(R) UHD Graphics 770 does not provide native support for double-precision floating point type.

Most remaining failures are AssertionErrors due to minor numerical precision differences typically within 1e-6 – 1e-7.

E       Max absolute difference among violations: 2.31522928e-07
E       Max relative difference among violations: 2.01987441e-06

Adjusting atol or rtol in the test suite for dpnp might help.

A few tests still attempt GPU allocations with float64 which should probably be handled in the test logic

sklearn/decomposition/tests/test_pca.py::test_pca_array_api_compliance
sklearn/metrics/tests/test_pairwise.py::test_pairwise_parallel_array_api
sklearn/utils/tests/test_extmath.py::test_randomized_svd_array_api_compliance
lspci

00:00.0 Host bridge: Intel Corporation Device 4660 (rev 02)
00:02.0 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
00:08.0 System peripheral: Intel Corporation 12th Gen Core Processor Gaussian & Neural Accelerator (rev 02)
00:14.0 USB controller: Intel Corporation Device 7ae0 (rev 11)
00:14.2 RAM memory: Intel Corporation Device 7aa7 (rev 11)
00:14.3 Network controller: Intel Corporation Device 7af0 (rev 11)
00:16.0 Communication controller: Intel Corporation Device 7ae8 (rev 11)
00:17.0 SATA controller: Intel Corporation Device 7ae2 (rev 11)
00:1b.0 PCI bridge: Intel Corporation Device 7ac4 (rev 11)
00:1c.0 PCI bridge: Intel Corporation Device 7abe (rev 11)
00:1d.0 PCI bridge: Intel Corporation Device 7ab0 (rev 11)
00:1d.4 PCI bridge: Intel Corporation Device 7ab4 (rev 11)
00:1f.0 ISA bridge: Intel Corporation Device 7a84 (rev 11)
00:1f.3 Audio device: Intel Corporation Device 7ad0 (rev 11)
00:1f.4 SMBus: Intel Corporation Device 7aa3 (rev 11)
00:1f.5 Serial bus controller: Intel Corporation Device 7aa4 (rev 11)
01:00.0 PCI bridge: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] (rev 02)
02:00.0 PCI bridge: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] (rev 02)
02:01.0 PCI bridge: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] (rev 02)
02:02.0 PCI bridge: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] (rev 02)
02:03.0 PCI bridge: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] (rev 02)
03:00.0 USB controller: Intel Corporation Thunderbolt 4 NHI [Maple Ridge 4C 2020]
37:00.0 USB controller: Intel Corporation Thunderbolt 4 USB Controller [Maple Ridge 4C 2020]
6b:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-LM (rev 03)
6c:00.0 Ethernet controller: Aquantia Corp. Device 14c0 (rev 03)
6d:00.0 Non-Volatile memory controller: Phison Electronics Corporation E16 PCIe4 NVMe Controller (rev 01)

lscpu

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 42 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 24
On-line CPU(s) list: 0-23
Vendor ID: GenuineIntel
Model name: 12th Gen Intel(R) Core(TM) i9-12900
CPU family: 6
Model: 151
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 1
Stepping: 2
CPU max MHz: 3900.0000
CPU min MHz: 800.0000
BogoMIPS: 4838.40
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fx
sr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts re
p_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor
ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc
_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_sin
gle ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase ts
c_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsave
opt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp
_act_window hwp_epp hwp_pkg_req umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri m
ovdir64b fsrm md_clear serialize pconfig arch_lbr flush_l1d arch_capabilities
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 640 KiB (16 instances)
L1i: 768 KiB (16 instances)
L2: 14 MiB (10 instances)
L3: 30 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-23
Vulnerabilities:
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Not affected
Retbleed: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Srbds: Not affected
Tsx async abort: Not affected

Intel Data Center GPU Max 1100 (PVC) (FP64 support)

Run without my previous changes since this GPU provides native FP64 support

3 failed, 1258 passed, 1 skipped, 41041 deselected, 203 warnings

Failures:

FAILED sklearn/metrics/tests/test_pairwise.py::test_pairwise_parallel_array_api[pairwise_kernels-callable_rbf_kernel-kwds2-dpnp-cpu-float64] - ValueError: Execution queue is not compatible with allocation queues
FAILED sklearn/metrics/tests/test_pairwise.py::test_pairwise_parallel_array_api[pairwise_kernels-callable_rbf_kernel-kwds2-dpnp-cpu-float32] - ValueError: Execution queue is not compatible with allocation queues
FAILED sklearn/model_selection/tests/test_validation.py::test_cross_val_predict_array_api_compliance[dpnp-cpu-float32-3-Ridge] - AssertionError:

These particular pairwise_parallel_array_api failures

ValueError: Execution queue is not compatible with allocation queues

did not appear on Alder Lake so they are likely related to the specific system configuration.
I will investigate this later

lspci 00:00.0 System peripheral: Intel Corporation Device 09a2 (rev 20) 00:00.1 System peripheral: Intel Corporation Device 09a4 (rev 20) 00:00.2 System peripheral: Intel Corporation Device 09a3 (rev 20) 00:00.4 Generic system peripheral [0807]: Intel Corporation Device 0b23 00:0d.0 PCI bridge: Intel Corporation Device 1bbd (rev 11) 00:14.0 USB controller: Intel Corporation Device 1bcd (rev 11) 00:14.2 RAM memory: Intel Corporation Device 1bce (rev 11) 00:14.4 Host bridge: Intel Corporation Device 1bfe (rev 11) 00:15.0 System peripheral: Intel Corporation Device 1bff (rev 11) 00:16.0 Communication controller: Intel Corporation Device 1be0 (rev 11) 00:16.1 Communication controller: Intel Corporation Device 1be1 (rev 11) 00:16.4 Communication controller: Intel Corporation Device 1be4 (rev 11) 00:1f.0 ISA bridge: Intel Corporation Device 1b81 (rev 11) 00:1f.4 SMBus: Intel Corporation Device 1bc9 (rev 11) 00:1f.5 Serial bus controller: Intel Corporation Device 1bca (rev 11) 01:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge (rev 06) 02:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 52)
lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 112 On-line CPU(s) list: 0-111 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) Platinum 8480+ CPU family: 6 Model: 143 Thread(s) per core: 1 Core(s) per socket: 56 Socket(s): 2 Stepping: 8 CPU max MHz: 3800.0000 CPU min MHz: 800.0000 BogoMIPS: 4000.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx f xsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monit or ds_cpl smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjus t bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflu shopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc c qm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dther m ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg av x512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_ lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lb r amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities Caches (sum of all): L1d: 5.3 MiB (112 instances) L1i: 3.5 MiB (112 instances) L2: 224 MiB (112 instances) L3: 210 MiB (2 instances) NUMA: NUMA node(s): 2 NUMA node0 CPU(s): 0-55 NUMA node1 CPU(s): 56-111 Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Reg file data sampling: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S Srbds: Not affected Tsx async abort: Not affected

@ogrisel

ogrisel commented Nov 6, 2025

Copy link
Copy Markdown
Member Author

Thanks @vlad-perevezentsev for your feedback. I will update this PR accordingly once I am done with other ongoing things.

Meanwhile:

  • don't you think dpctl should automatically do the equivalent of export OCL_ICD_FILENAMES="$(find $(python -c 'import sys; print(sys.prefix)') -type f -name 'libintelocl.so' 2>/dev/null | head -n 1)" when importing it to avoid having to do it manually as a user (when OCL_ICD_FILENAMES is not already explicitly defined)?
  • are you aware of a public cloud or CI service that provides access to Intel GPUs?

@napetrov

napetrov commented Nov 6, 2025

Copy link
Copy Markdown
Contributor
  • are you aware of a public cloud or CI service that provides access to Intel GPUs?

Sadly - there are non at this point. I'm working on potentially getting some available for few projects but there are lot of challenges. will be back to you in case anything will be available

@david-cortes-intel

Copy link
Copy Markdown
Contributor

Thanks @vlad-perevezentsev for your feedback. I will update this PR accordingly once I am done with other ongoing things.

Meanwhile:

  • don't you think dpctl should automatically do the equivalent of export OCL_ICD_FILENAMES="$(find $(python -c 'import sys; print(sys.prefix)') -type f -name 'libintelocl.so' 2>/dev/null | head -n 1)" when importing it to avoid having to do it manually as a user (when OCL_ICD_FILENAMES is not already explicitly defined)?
  • are you aware of a public cloud or CI service that provides access to Intel GPUs?

A small comment on the first point that if you are installing things from conda, it can be sorted out by installing this package from Intel's channel:
https://github.com/IntelPython/intel-gpu-ocl-icd-system-feedstock

conda install -c https://software.repos.intel.com/python/conda/ intel-gpu-ocl-icd-system

If things are installed from pip, depending on from where each dependency comes from (system / pip / conda / etc.), that workaround might not always be required.

@ogrisel ogrisel moved this to Todo in Array API Mar 24, 2026
@cakedev0

cakedev0 commented Apr 29, 2026 •

Copy link
Copy Markdown
Member

Ok it's simple: we call move_to(..., xp=np) in many places, which calls _max_precision_float_dtype but numpy<2.4 doesn't not have __array_namespace_info__.

We can fix the tests by adding those two lines either in move_to or in _max_precision_float_dtype:

if _is_numpy_namespace(xp):
    xp = np_compat

But maybe the proper fix would be to change all the call sites with xp=np_compat, because np is not really a valid value for an xp parameter as for old versions it does not implement the array API specs.

@ogrisel

ogrisel commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

I pushed 6108f28 as a more pragmatic workaround to restore backward compat with older numpy version without changing all the move_to(..., xp=np) calls.

@betatim

betatim commented Apr 29, 2026

Copy link
Copy Markdown
Member

This was indeed caused by a missing device=device when allocating the output device array into which the results are inserted via __setitem__. Curiously enough, both array-api-strict and pytorch allow silent device transfer in this case while they raise for other kinds of implicit transfers...

Do you have a link to the test/code where this happens or (even better) a small reproducer? At first glance this sounds like something that could be a bug in array-api-strict's "multi device" implementation

@github-actions github-actions Bot removed the CUDA CI label Apr 29, 2026
@ogrisel

ogrisel commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

Do you have a link to the test/code where this happens or (even better) a small reproducer? At first glance this sounds like something that could be a bug in array-api-strict's "multi device" implementation

Yes, it's a known limitation of array-api-strict, part of the list of limitations documented in data-apis/array-api-strict#70 (comment) (the link points to a specific comment with a reproducer I wrote recently but it was already documented in the description of the meta-issue).

@ogrisel

ogrisel commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

I re-ran the dpnp and xpu tests on my Intel GPU machine and all float32 tests still pass. The remaining float64 and CI config effort is planned for follow-up PRs as documented in the issue description so this PR is good to go from my point of view.

@cakedev0 cakedev0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this PR is good to go, thanks @ogrisel

I've started working on some of the follow-ups

@betatim betatim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small nits and education questions. Otherwise looks good to me

Comment thread sklearn/utils/_array_api.py Resolved
Comment thread sklearn/utils/_testing.py Resolved
@betatim

betatim commented Apr 29, 2026

Copy link
Copy Markdown
Member

Do you have a link to the test/code where this happens or (even better) a small reproducer? At first glance this sounds like something that could be a bug in array-api-strict's "multi device" implementation

Yes, it's a known limitation of array-api-strict, part of the list of limitations documented in data-apis/array-api-strict#70 (comment) (the link points to a specific comment with a reproducer I wrote recently but it was already documented in the description of the meta-issue).

Ah, I saw that issue but didn't realise the connection.

@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Apr 29, 2026
@github-actions github-actions Bot removed the CUDA CI label Apr 29, 2026
@ogrisel
ogrisel enabled auto-merge (squash) April 29, 2026 14:37
@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Apr 29, 2026
@ogrisel
ogrisel merged commit f1cc4e7 into scikit-learn:main Apr 29, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Labs Apr 29, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Array API Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

10 participants