Skip to content

Proposal: opt-in SYCL build for Intel GPUs and CPUs (Python) #885

Backlog

Description

@Einse57

Is your feature request related to a problem? Please describe.
TIGRE builds only with CUDA, so it needs an NVIDIA GPU and has no CPU fallback. On machines without one (laptops with integrated graphics, workstations with a discrete Intel GPU, or CPU-only machines), TIGRE cannot be used.

Describe the solution you'd like
An opt-in SYCL build of the compiled modules, next to the CUDA build, which stays the default. A working version is on a fork: https://github.com/Einse57/TIGRE/tree/sycl-on-3.2.0

  • Common/SYCL/: SYCL versions of all the Common/CUDA sources the Python build compiles (cone and parallel Siddon and interpolated projectors, the backprojectors, GD_TV, GD_AwTV, tv_proximal, PICCS, RandomNumberGenerator, gpuUtils, GpuIds), plus a small shared helper (tigre_sycl.cpp/.hpp). They implement the same C++ interfaces and reuse the headers in Common/CUDA.
  • setup.py: with TIGRE_SYCL=1, those sources are compiled with the oneAPI DPC++ compiler (icpx, or icx on Windows; TIGRE_SYCL_CXX overrides it) instead of nvcc, and no CUDA toolkit is needed. Without the variable, the build is unchanged. Common/CUDA and the Cython bindings are not modified.
  • Devices: the Level Zero GPUs if there are any, otherwise the other GPUs, otherwise the remaining SYCL devices (such as the CPU through the Intel OpenCL CPU runtime). With TIGRE_SYCL_ALL_DEVICES=1, the remaining devices are listed after the GPUs. gpuids index into that list, and ONEAPI_DEVICE_SELECTOR filters it.
  • Docs: a "SYCL build" section in docs/install/python.md.
  • CI: .github/workflows/sycl.yml builds with conda-forge's DPC++ 2025.2 and runs the full pytest suite on the SYCL CPU device on ubuntu-latest and windows-latest, so the gpu-marked tests also run on GitHub-hosted runners.

Tested on Windows 11 with oneAPI DPC++ 2025.2:

  • Intel Arc 140T integrated GPU (Core Ultra 9 285H), Level Zero
  • Intel Arc Pro B50 discrete GPU, Level Zero
  • Intel Core Ultra 9 285H and Core Ultra 7 265F, Intel OpenCL CPU runtime

The full pytest suite gives 242 passed and 27 skipped on the Arc Pro B50 (commit 54e0ad1) and on the CPU device in the CI workflow (Linux and Windows), and 241 passed and 27 skipped on the Arc 140T (commit e1fab7e, which does not have the last tvdenoise fix or its added test). With PyTorch installed (2.15.0, CPU build), the Arc Pro B50 gives 248 passed and 26 skipped: the 6 tests in test_pytorch_bindings.py then run and pass. The 26 skipped tests are: 8 that need two or more GPUs (with the B50 and the CPU device together, all 8 pass); 2 test files that need PyTorch on a CUDA GPU (test_gpu_arrays.py and test_tv_low_memory.py, each skipped as one module); and 16 that are CUDA-specific (CUDA runtime, texture limits and texture objects). Untested: SYCL on non-Intel GPUs (AMD, NVIDIA), other Intel GPUs, and Intel GPUs on Linux.

Wall-time measurements and GPU vs CPU-device parity: https://github.com/Einse57/TIGRE/blob/sycl-on-3.2.0/notes/MEASUREMENTS.md. For example, algs.fdk on a 128³ volume with 60 projections took 0.035 s on the Arc 140T and 0.023 s on the Arc Pro B50 (0.13 s and 0.089 s on the two CPUs).

One behavioural difference from the CUDA build: CTnoise.add uses a different random number generator, so its values differ for the same input.

Known gaps:

Questions:

  1. Is an opt-in SYCL build something you would accept in TIGRE?
  2. If so, how would you prefer it split? For example: (a) build switch, Common/SYCL sources and docs; (b) the CI workflow; (c) MATLAB support later. One PR or several, rebased on current master.

Describe alternatives you've considered

  • HIP, as in [ROCm] Add AMD GPU support to the Python backend #747 (AMD GPUs, also opt-in with CUDA as the default). It covers different hardware and is independent of this proposal. Both change the build-selection part of setup.py.
  • OpenCL C kernels, which would mean rewriting the kernels in a separate language. SYCL keeps them in C++ with a structure close to the CUDA sources.

Additional context
Related: #131 (HIP for AMD GPUs), #747 (ROCm/HIP build), #244 (shared Common/ source layout, which a Common/SYCL folder follows).

Activity

  1. AnderBiguri commented on Nov 19, 2026

    @AnderBiguri
    Member

    Thanks a lot for this, it's a very thorough piece of work.

    1. Yes, an opt-in SYCL build is something I'd like to have in TIGRE, with CUDA staying the default. CPU support through the SYCL CPU device is fine too. I'd document it as Intel CPUs (that's what Intel's OpenCL CPU runtime officially supports), with AMD x86 as untested. Ideally if we add CPU code I'd like it to be general for any CPU, but we can just do this and then open an issue describing that CPU support is limited/untested.

    2. How to split it: several PRs, each rebased on current master, please. Give me a couple of days until I release TIGRE 3.3.0 with all fixes for GPU code that I have been doing lately, and then:

    • (a) The build switch, Common/SYCL and the docs.
    • (b) The CI workflow, separately, so we can decide on its own whether it runs here (10–20 minutes is fine if it only runs on PRs that touch Common/ or the build).
    • (c) MATLAB later.

    As I like to be able to read the code, try to not make gigantic PRs, keep them feature-wise. I assume that at least one will be big "add all SYCL files" or something like that, but in general one feature each makes my life to test and understand the code better.

    Build selection: before (a), I'd like to agree on one way to choose the backend, since #747 (HIP) also changes this part of setup.py, and there is also a Metal (Apple Silicon) backend in progress. Instead of one on/off variable per backend, I'd prefer a single TIGRE_BACKEND=cuda|hip|sycl and, when it's not set, automatic detection based on which compiler is installed (nvcc/CUDA_HOME, then hipcc/ROCM_PATH, then icpx/icx), with CUDA first so that machines with an NVIDIA GPU and an Intel iGPU keep building CUDA. The build should print which backend it picked and why. Would that work for you? I'll ask the same on #747 so both PRs use it.

    Maintenance: CUDA will stay the reference implementation, and I don't have Intel hardware to test on. When CUDA code changes, I'll open an issue for the matching SYCL change, so it would be great if you (or other SYCL users) could keep an eye on those.

    Benchmarks: It would be good to have at some point measurements of speed vs CUDA with exactly the same code. If you don't have access to this from your side, you can add a test code that I can rerun on my CUDA machines to compare.

    The tv_proximal.cu exchange buffer: good catch, thanks. I checked current master and the CUDA code has the same problem: the non-peer host buffer has one slice per slot, but each copy moves buffer_length slices, so with buffer_length > 1 the slots overlap and the last one writes past the end. It needs 2+ GPUs without peer access and splits == 1, which isn't that rare on consumer cards. I'll open a separate issue and fix it in CUDA, it will come before 3.3.0.

  2. Einse57 commented on Nov 19, 2026

    @Einse57
    ContributorAuthor

    Thanks for the review!

    TIGRE_BACKEND=cuda|hip|sycl with auto-detection (CUDA first, then HIP, then SYCL) and a printed reason works for me. I'll switch the SYCL build to that.

    I'll wait for 3.3.0, then rebase and open the PRs in the order you listed.

    For CPU support, will document Intel CPUs as supported and AMD x86 as untested.

    I'll also do my best to follow the CUDA-to-SYCL issues as they come up.

    For the CUDA comparison, I'll add a small script that times the same projectors and algorithms on whichever backend is built, so you can rerun it on your CUDA machines.

    Thanks for confirming the tv_proximal.cu buffer issue.

  3. AnderBiguri commented on Nov 21, 2026

    @AnderBiguri
    Member

    Hi @Einse57, thanks a lot for the two reports from your SYCL work. Both are fixed in TIGRE 3.3.0 (https://github.com/CERN/TIGRE/releases/tag/v3.3.0):

    Two other changes may be useful for the port:

    • AwminTV now shares its host code with minTV and PICCS (tv_gradient_descent in GD_TV.cu), so there's one less copy of the splitting and halo logic to port.
    • The build selects the backend with TIGRE_BACKEND; sycl currently stops with a message pointing to this issue.

    Thanks also for the credit in the release notes. Looking forward to the SYCL backend!

  4. AnderBiguri commented on Nov 21, 2026

    @AnderBiguri
    Member

    Hi @Einse57, thanks for splitting the SYCL work up so nicely. A heads-up: benchmarking 3.3.0 against ASTRA showed that our multi-GPU Ax/Atb spend a large part of each call outside the kernels (page-locking host memory on every call, and sending the whole image or all projections to every GPU). We'll change how the operators handle host memory and split work across GPUs in TIGRE 3.3.1, in the next few days. Since the SYCL projectors mirror the Common/CUDA host code, it may be worth waiting a couple of days before porting more of it, so you port the new version once. The device list, the build switch and the kernels themselves shouldn't be affected.

    Sorry again, I should have caught this earlier.

  5. Einse57 commented on Nov 22, 2026

    @Einse57
    ContributorAuthor

    Thanks for the heads-up. I'll hold the remaining SYCL PRs until 3.3.1 is out, then rebase #902's projector host code onto the new Ax/Atb host-memory and splitting code.

  6. AnderBiguri commented on Nov 23, 2026

    @AnderBiguri
    Member

    OK done! https://github.com/CERN/TIGRE/releases/tag/v3.3.1

    No more refactoring the GPU code anymore from my side, all free to fiddle with! Let me know if you need some understanding on what changed. Most of it was about speed and multi-GPU codes. I suspect large amount of the changes are not trivially transferable to SYCL. In the sense that many of the changes from 3.3.0 to 3.3.1 are about how CUDA compiles kernels, what takes time in an NVIDIA GPU and ways to minimize that.

    I do not require the SYCL port to do this deep optimization of the codes, it existing is already a great feature.

  7. Einse57 commented on Nov 24, 2026

    @Einse57
    ContributorAuthor

    Thanks Ander, really appreciate the 3.3.1 work and the notes. I rebased #902 onto 3.3.1. The SYCL forward projectors now follow the same page-locking and splitting rules, and they match the CPU device on an Arc Pro B70. I'll send CI, Atb, TV and docs one PR at a time after #902.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions