Skip to content

Add compile-time dispatching examples for generic BLAS and portFFT backends - #752

Open
zjin-lcf wants to merge 1 commit into
uxlfoundation:developfrom
zjin-lcf:examples-generic-portfft
Open

Add compile-time dispatching examples for generic BLAS and portFFT backends#752
zjin-lcf wants to merge 1 commit into
uxlfoundation:developfrom
zjin-lcf:examples-generic-portfft

Conversation

@zjin-lcf

Copy link
Copy Markdown
Contributor

Summary

Closes #714.

The SYCL-only generic BLAS and portFFT backends cannot be combined with any other backend, so the existing compile-time dispatching examples (which pair mklcpu with a vendor GPU backend) do not cover them. This PR adds standalone, single-device compile-time dispatching examples so users can build and run something to validate these backends:

  • examples/blas/compile_time_dispatching/level3/gemm_usm_generic.cpp — GEMM via backend_selector<backend::generic>, built when ENABLE_GENERIC_BLAS_BACKEND is on (links onemath_blas_generic).
  • examples/dft/compile_time_dispatching/complex_fwd_usm_portfft.cpp — complex in-place forward DFT via backend_selector<backend::portfft>, built when ENABLE_PORTFFT_BACKEND is on (links onemath_dft_portfft). Only the COMPLEX domain is used since portFFT does not support REAL.

The BLAS and DFT compile-time CMakeLists.txt files are restructured to guard each backend combination independently (instead of an early return()), so the new SYCL-only examples build alongside the existing ones. Both examples are registered as ctests and documented in examples/README.md with sample output.

Test plan

Built and run on an Intel(R) Arc(TM) B580 Graphics GPU with the DPC++ (icpx 2025.3.1) compiler:

cmake -B build -G Ninja \
  -DCMAKE_CXX_COMPILER=icpx -DCMAKE_C_COMPILER=icx \
  -DENABLE_MKLGPU_BACKEND=OFF -DENABLE_MKLCPU_BACKEND=OFF \
  -DENABLE_GENERIC_BLAS_BACKEND=ON -DENABLE_PORTFFT_BACKEND=ON \
  -DTARGET_DOMAINS="blas;dft" \
  -DBUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON \
  -DGENERIC_BLAS_TUNING_TARGET=INTEL_GPU
cmake --build build -j

Results:

  • example_blas_gemm_usm_generic — ran OK, exit 0.
  • example_dft_complex_fwd_usm_portfft — ran OK, exit 0.

Note for the reporter: the first run of each example is slow because the kernels are JIT-compiled by IGC on the B580; this can look like a hang. Allowing it to finish (or building AOT with -fsycl-targets=spir64_gen -Xs "-device bmg") resolves it.

…ckends

The SYCL-only generic BLAS and portFFT backends cannot be combined with
any other backend, so the existing compile-time examples (which pair
mklcpu with a vendor GPU backend) do not cover them. Add standalone
single-device examples so users can validate these backends:

- blas: level3/gemm_usm_generic (built with ENABLE_GENERIC_BLAS_BACKEND)
- dft: complex_fwd_usm_portfft (built with ENABLE_PORTFFT_BACKEND, COMPLEX
  domain only)

The BLAS and DFT compile-time CMakeLists are restructured to guard each
backend combination independently instead of returning early. The
examples README documents both new examples with sample output.

Both examples were verified on an Intel Arc B580 GPU with the DPC++
compiler.

Addresses uxlfoundation#714

Co-authored-by: Cursor <cursoragent@cursor.com>
@zjin-lcf
zjin-lcf requested review from a team as code owners August 11, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example code for SYCL generic BLAS and portFFT backends

1 participant