Description
Problem
The README file of this repository is fairly short. That is not necessarily a bad thing, but it is not immediately clear how this repository is used in PyTorch. The confusion stems from the many repositories floating around that developers have to spend time figuring out the relation between:
- The original/stock PyTorch repository
- The Intel Extension for PyTorch (IPEX) repository (and its internal Intel fork)
- This repository and (its internal Intel fork)
I had a misunderstanding for a long time that stock PyTorch has very poor integration of oneMKL SYCL APIs because I had tried and failed to find oneMKL's API calls in the stock PyTorch repository. Due to GitHub Search only indexing, searching and giving results for the main branch of any repository, searching for oneMKL SYCL APIs in the IPEX repository also pops up no results at all (which is because, as I now finally know, the GPU parts are in its xpu-main
branch instead, so you have to git clone the repo and check out that branch to be able to then search for what you want locally). Then I searched this repository, and I found that only mkl::dft
and mkl::lapack
APIs are integrated but not mkl::blas
, which was even more confusing (at first, but I now finally know that oneMKL BLAS SYCL APIs are integrated in xpu-main
branch of IPEX instead).
At the same time, this repository is not a submodule of stock PyTorch either. Buried in a large heap of files in some corner, there is pytorch/pytorch/third_party/xpu.txt which indicates which commit from this repository is to be used with PyTorch. Because it is not a submodule of PyTorch, in some entirely different corner of PyTorch, that commit of this repository is git clone
'd (presumably) when building PyTorch XPU build in pytorch/pytorch/caffe2/CMakeLists.txt. This is not obvious at all!
I had also tried to run some model with PyTorch XPU build with DNNL_VERBOSE=1
and MKL_VERBOSE=1
, and unfortunately no oneMKL SYCL APIs had popped up, once again misleading me to think that PyTorch integration of oneMKL was poor.
Request
- Please update the README of this repository to avoid developers from getting confused or walking away with incomplete/incorrect information.
- The README should clarify the following:
- How does this repository fit into the PyTorch XPU build (this is only partially clear),
- That this repository is not a submodule of PyTorch (yet?), but is (a) really cloned and used when building PyTorch XPU from source, and (b) is essentially built into the pip-installated PyTorch XPU.
- How this repository relates to IPEX, whether IPEX depends on this repository as well or whether this repository depends on IPEX
- Whether this repository (a) overrides and/or (b) augments implementations in IPEX, or vice-versa when both PyTorch XPU and IPEX are installed.
- Whether kernels from this repository are used in PyTorch XPU directly or whether PyTorch calls IPEX which then calls kernels from this repository (or something else).
- Whether there is any plan to add this repository as a submodule in PyTorch like many of the others are as seen at pytorch/pytorch/third_party.
- I have a question I'd like answered here if you can:
- If I am correctly understanding that IPEX is an optional extension for PyTorch whereas this repo is always used for PyTorch XPU builds, and given that this repo only seems to contain
mkl::dft
andmkl::lapack
SYCL API calls, does that mean that a pure PyTorch XPU build without IPEX installed will have no calls tomkl::blas
domain APIs? Won't that mean suboptimal or incomplete SYCL support in PyTorch XPU build? Or is it that pure PyTorch XPU without IPEX relies purely on oneDNN for BLAS operations like dense matrix multiplications, and is therefore optimal without possibly relying on oneMKL BLAS SYCL APIs (unless oneDNN utilizes it underneath, if at all, of course)?
- If I am correctly understanding that IPEX is an optional extension for PyTorch whereas this repo is always used for PyTorch XPU builds, and given that this repo only seems to contain