Repository navigation
Register dpnp as a new array API namespace to test against - #32460
Conversation
|
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: 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 import dpctl
dpctl.get_devices(device_type="gpu")If you installed those packages from pip, you probably need to manually set |
|
On my laptop:
```
lscpulspci |
|
@jeremiedbb thanks for testing. Could you please edit your comment to add the output of |
|
Maybe you could try in another conda env specifically created to included all the dependencies for the Intel Distribution for Python. |
I edited my comment |
|
Does not seem to detect my GPU either. I tried both installing dpnp and the Intel distribution for Python (with mamba), same result. lspcilscpu |
dpnp as array API namespace to test againstdpnp as a new array API namespace to test against
same result :/ |
|
Maybe there is an OS level driver to install to get the GPU detected. EDIT: I suspect this is the cause: https://www.intel.com/content/www/us/en/developer/articles/system-requirements/oneapi-dpcpp/2025.html#:~:text=GPU%20Drivers |
|
We might want to bump |
|
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? |
|
Note for later, the following command gives more precise info about the identifier of the graphics card controller: The output of which can be looked up in the following table: |
|
@ogrisel Thanks for your interest in integrating Env setupEnv infoOn Alder Lake-S GT1 On Intel Data Center GPU Max 1100 (PVC) Integrated GPU Alder Lake-S GT1 (UHD Graphics) Most of the failures were caused by This is expected because most integrated Intel GPUs (UHD Graphics, Iris Xe, Alder Lake. ..) lack native double-precision floating point (float64) support. As an experiment, I tried disabling float64 testing for most GPU cases with a small changes to After this change: short test summary infoFAILED 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. Most remaining failures are Adjusting A few tests still attempt GPU allocations with lspci00:00.0 Host bridge: Intel Corporation Device 4660 (rev 02) lscpuArchitecture: x86_64 Intel Data Center GPU Max 1100 (PVC) (FP64 support) Run without my previous changes since this GPU provides native FP64 support Failures: These particular did not appear on Alder Lake so they are likely related to the specific system configuration. lspci00: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)lscpuArchitecture: 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 |
|
Thanks @vlad-perevezentsev for your feedback. I will update this PR accordingly once I am done with other ongoing things. Meanwhile:
|
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 |
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: conda install -c https://software.repos.intel.com/python/conda/ intel-gpu-ocl-icd-systemIf things are installed from pip, depending on from where each dependency comes from (system / pip / conda / etc.), that workaround might not always be required. |
|
Ok it's simple: we call We can fix the tests by adding those two lines either in if _is_numpy_namespace(xp):
xp = np_compatBut maybe the proper fix would be to change all the call sites with |
|
I pushed 6108f28 as a more pragmatic workaround to restore backward compat with older numpy version without changing all the |
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). |
|
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. |
betatim
left a comment
There was a problem hiding this comment.
Some small nits and education questions. Otherwise looks good to me
Ah, I saw that issue but didn't realise the connection. |
Co-authored-by: Tim Head <[email protected]>
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_FILENAMESenv name to point to the location of the"libintelocl.so"file: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
RuntimeErrorraised when passingdevice="xpu"totorch.from_dlpackpytorch/pytorch#181140float32tests now pass \o/faulthandler(EDIT: caused by colliding Intel OpenMP and LLVM OpenMP runtimes in my Python env with mixed conda and pip dependencies).dpnpas a new array API namespace to test against #32460 (comment)TODO in follow-up PRs
float64failures to investigate (1 with DPNP and 18 with PyTorch XPU, but many are related)