Intel XPU for CUDA Developers · Part 1

From CUDA to Intel Xe — Part 1: Vector Add

Series: Intel GPU Kernel Programming for CUDA Developers · Part 1
Audience: Developers familiar with CUDA who want to write their first kernel for Intel® GPUs.

If you already know how to launch a CUDA kernel, you know most of the concepts needed to get started on Intel GPUs. While API (Application Programming Interface) names and hardware organization differ, your first kernel is familiar: adding two arrays.

We will start with side-by-side CUDA and SYCL examples, introduce the corresponding Intel GPU concepts, and trace how one output element maps onto a parallel worker.

1. What Is an Intel XPU?

XPU is Intel's umbrella term for heterogeneous compute architectures—spanning CPUs, GPUs, NPUs (Neural Processing Units), and FPGAs (Field-Programmable Gate Arrays)—not the name of a single GPU instruction set. This series specifically targets Intel® Xe GPUs. In the software stack, Xe names the GPU architecture family, SYCL is the open Khronos Group C++ programming model, and Intel® oneAPI provides the compiler, runtime, and libraries. These are distinct layers of the stack.

LayerNVIDIA / CUDA ConceptIntel Xe / oneAPI CounterpartImportant Qualification
GPU ArchitectureNVIDIA Hopper / BlackwellIntel Xe2 / Xe3PArchitecture generations—not 1:1 product or sm_XX (Streaming Multiprocessor target) equivalents
Programming ModelCUDA C++ language and runtimeKhronos SYCL with Intel oneAPISimilar parallel execution concepts; SYCL is an open C++ standard
Compilernvcc (NVIDIA CUDA Compiler)icpx -fsyclIntel® oneAPI DPC++/C++ (Data Parallel C++) Compiler—Just-In-Time (JIT) by default, or Ahead-of-Time (AOT) for target GPUs
Kernel DispatchCUDA kernel launch <<<grid, block>>>SYCL q.parallel_for(nd_range, ...)Different host syntax; equivalent hierarchical work decomposition

Quick naming note: Xe2 and Xe3P name the GPU architecture generation (comparable in role to Hopper or Blackwell), while Intel® Arc™ Pro B60 / B70 Graphics and Intel GPU D-series (code-named Crescent Island) name the GPU products built on them (comparable in role to H100 or B200).

2. Recent Intel GPUs: Xe2 and Xe3P

The table below summarizes published specifications for two recent Intel Xe GPU families: workstation Intel® Arc™ Pro B60 and B70 Graphics and data center Intel GPU D-series (code-named Crescent Island).

Published SpecificationArc Pro B60 ↗Arc Pro B70 ↗Intel GPU D-Series (Crescent Island) ↗
ArchitectureXe2Xe2Xe3P
Target WorkloadWorkstation & local AI inferenceWorkstation & local AI inferenceData center AI inference
Memory Capacity24 GB GDDR632 GB GDDR6Up to 480 GB LPDDR5X
Memory Bandwidth456 GB/s608 GB/s—
Highlighted AI Matrix FormatsFP16 / BF16 / INT8 / INT4FP16 / BF16 / INT8 / INT4Adds FP8 / MXFP8 / MXFP4 (announced)

Specifications & abbreviations note: Specifications reflect published Intel disclosures; memory capacity, power, and board configurations may vary by partner design. GDDR6 = Graphics Double Data Rate 6; LPDDR5X = Low-Power Double Data Rate 5X; GB/s & TB/s = Gigabytes & Terabytes per second.

3. Start with the Code: CUDA vs. Intel SYCL Vector Add

Let's start with a hands-on example: adding two arrays of 256 elements using 256 parallel workers (CUDA threads or SYCL work-items), organized into two groups of 128. Both examples follow the same six stages. For GPU kernel development, focus on Stage 4: Kernel—the GPU computation and how it is launched. The other stages are supporting host-side code for setup, memory, initialization, verification, and cleanup.

1 Setup 2 Allocate 3 Initialize 4 Kernel 5 Verify 6 Cleanup

CUDA Example (vector_add_cuda.cu)

// vector_add_cuda.cu
#include <cuda_runtime.h>
#include <cstddef>
#include <iostream>

// GPU kernel: each CUDA thread computes one element.
// SYCL counterpart: lambda inside q.parallel_for(...).
__global__ void vector_add(
    const float* a, const float* b,
    float* c, int n) {
  const int i = blockIdx.x * blockDim.x + threadIdx.x;
  if (i < n) {
    c[i] = a[i] + b[i];
  }
}

// Check all elements (same helper structure as SYCL).
bool verify(const float* a, const float* b,
            const float* c, int n) {
  for (int i = 0; i < n; ++i) {
    if (c[i] != a[i] + b[i]) {
      std::cerr << "Mismatch at index " << i << "\n";
      return false;
    }
  }
  std::cout << "c[255] = " << c[n - 1] << " | PASS\n";
  return true;
}

int main() {
  constexpr int N = 256;
  float *a = nullptr, *b = nullptr, *c = nullptr;

  // Stage 1: Select a CUDA device.
  if (cudaSetDevice(0) != cudaSuccess) {
    std::cerr << "CUDA GPU selection failed\n";
    return 1;
  }

  // Stage 2: Allocate managed shared memory.
  const std::size_t bytes = N * sizeof(float);
  if (cudaMallocManaged(&a, bytes) != cudaSuccess ||
      cudaMallocManaged(&b, bytes) != cudaSuccess ||
      cudaMallocManaged(&c, bytes) != cudaSuccess) {
    std::cerr << "CUDA allocation failed\n";
    cudaFree(a); cudaFree(b); cudaFree(c); return 1;
  }

  // Stage 3: Initialize input arrays.
  for (int i = 0; i < N; ++i) {
    a[i] = float(i);
    b[i] = float(2 * i);
  }

  // Stage 4: Kernel launch—grid/block and synchronize.
  // CUDA (x, y, z) maps to SYCL (d0=z, d1=y, d2=x).
  dim3 block(128, 1, 1);  // 128 threads per block
  dim3 grid((N + block.x - 1) / block.x, 1, 1);
  vector_add<<<grid, block>>>(a, b, c, N);
  cudaError_t err = cudaGetLastError();
  if (err == cudaSuccess) err = cudaDeviceSynchronize();

  // Stage 5: Verify all outputs.
  bool ok = false;
  if (err == cudaSuccess) {
    ok = verify(a, b, c, N);
  } else std::cerr << cudaGetErrorString(err) << "\n";

  // Stage 6: Clean up.
  cudaFree(a);
  cudaFree(b);
  cudaFree(c);
  return ok ? 0 : 1;

}

Build and run (CUDA):

# NVIDIA CUDA Toolkit and a CUDA-capable GPU required:
nvcc -O2 vector_add_cuda.cu -o vector_add_cuda
./vector_add_cuda

Intel SYCL Example (vector_add_sycl.cpp)

#include <sycl/sycl.hpp>
#include <cstddef>
#include <iostream>
#include <stdexcept>

// Host-side helper: submits the GPU kernel lambda.
// CUDA counterpart: vector_add<<<grid, block>>>(...).
void vector_add(sycl::queue& q, sycl::nd_range<3> launch,
                const float* a, const float* b,
                float* c, std::size_t n) {
  q.parallel_for(launch, [=](sycl::nd_item<3> item) {
    const std::size_t i = item.get_global_id(2);
    if (i < n) {
      c[i] = a[i] + b[i];
    }
  });
}

// Check all elements (same helper structure as CUDA).
bool verify(const float* a, const float* b,
            const float* c, std::size_t n) {
  for (std::size_t i = 0; i < n; ++i) {
    if (c[i] != a[i] + b[i]) {
      std::cerr << "Mismatch at index " << i << "\n";
      return false;
    }
  }
  std::cout << "c[255] = " << c[n - 1] << " | PASS\n";
  return true;
}

int main() {
  constexpr std::size_t N = 256;
  float *a = nullptr, *b = nullptr, *c = nullptr;

  // Stage 1: Select a GPU and create a queue.
  sycl::queue q{sycl::gpu_selector_v};
  bool ok = false;

  try {

    // Stage 2: Allocate USM (Unified Shared Memory).
    a = sycl::malloc_shared<float>(N, q);
    b = sycl::malloc_shared<float>(N, q);
    c = sycl::malloc_shared<float>(N, q);
    if (!a || !b || !c) {
      throw std::runtime_error(
          "USM allocation failed");
    }

    // Stage 3: Initialize input arrays.
    for (std::size_t i = 0; i < N; ++i) {
      a[i] = float(i);
      b[i] = float(2 * i);
    }

    // Stage 4: Kernel launch—configure 3D ranges.
    // CUDA (x, y, z) maps to SYCL (d0=z, d1=y, d2=x).
    sycl::range<3> block(1, 1, 128);  // 128 work-items
    sycl::range<3> grid(1, 1, (N + block.get(2) - 1) / block.get(2));
    const sycl::nd_range<3> launch{grid * block, block};
    vector_add(q, launch, a, b, c, N);
    q.wait_and_throw();

    // Stage 5: Verify all outputs.
    ok = verify(a, b, c, N);
  } catch (const std::exception& e) {
    std::cerr << "SYCL error: " << e.what() << "\n";
  }

  // Stage 6: Clean up (also after errors).
  if (a) sycl::free(a, q);
  if (b) sycl::free(b, q);
  if (c) sycl::free(c, q);
  return ok ? 0 : 1;

}

Build and run (Intel SYCL):

# Intel oneAPI DPC++/C++ Compiler & Intel GPU driver:
icpx -O2 -fsycl vector_add_sycl.cpp -o vector_add_sycl
./vector_add_sycl

3.1 Don't Fear the Lambda: Two Colors Separate Template vs. Kernel

Don't let the C++ lambda syntax intimidate you—every character in vector_add belongs to one of two colors. Copy the blue SYCL template shell unchanged, and edit only the amber kernel sections when writing a new GPU kernel:

void vector_add(sycl::queue& q, sycl::nd_range<3> launch,
                const float* a, const float* b,
                float* c, std::size_t n) {
  q.parallel_for(launch, [=](sycl::nd_item<3> item) {    const std::size_t i = item.get_global_id(2);
    if (i < n) {
      c[i] = a[i] + b[i];
    }  });
}
Blue · Fixed SYCL Template (Copy As-Is)
  • sycl::queue& q, sycl::nd_range<3> launch — target GPU queue and N-Dimensional Range (nd_range) launch configuration.
  • q.parallel_for(launch, [=](sycl::nd_item<3> item) { ... }); — replaces CUDA __global__ + <<<grid, block>>>; [=] captures your pointers and scalars by value automatically.
Amber · Your Kernel Code (Change for a New Kernel)
  • Function name & data arguments: rename vector_add and list your pointers and scalars (a, b, c, n).
  • Worker index & math: read item.get_global_id(...) and write your per-worker body—just like a CUDA __global__ kernel.

4. Understand the Code: From CUDA to SYCL

Now let's decode the SYCL example above using CUDA concepts you already know. The SYCL vector_add() function is a host-side submission helper, while the lambda passed to q.parallel_for is the actual device kernel; CUDA defines its GPU kernel with __global__. There are only four new ideas: Unified Shared Memory (USM) allocation, queue submission, work-item organization, and global indexing.

Find This in the CodeCUDAIntel SYCL
Allocate A, B, and C in shared memorycudaMallocManagedsycl::malloc_shared (Unified Shared Memory, USM)
Launch the kernelvector_add<<<grid, block>>>vector_add(q, launch, ...) (calls q.parallel_for)
Describe the launchdim3 grid(2,1,1), block(128,1,1)range<3> grid(1,1,2), block(1,1,128)
Wait before reading CcudaDeviceSynchronize()q.wait_and_throw()

These rows map the concrete APIs (Application Programming Interfaces) used in the sample, not necessarily identical queue-ordering or memory-migration semantics.

4.1 Kernel Launch: How 256 Workers Are Organized

Look back at vector_add<<<grid, block>>> and the SYCL N-Dimensional Range nd_range<3>{{1,1,256},{1,1,128}}. Both launch 256 logical workers in two groups of 128. CUDA warps have 32 threads, while the Intel pane illustrates a 32- or 16-work-item sub-group using SIMD (Single Instruction, Multiple Data) widths of 32 or 16. The 4×8 or 2×8 grid is a visual arrangement, not a physical hardware lane layout:

Visualization only: the SIMD16/SIMD32 (16-wide / 32-wide Single Instruction, Multiple Data) toggle changes the illustration; it does not compile or run different kernels. On Intel GPUs, the compiler selects a device-supported sub-group width unless the kernel explicitly requests one (for example, with [[sycl::reqd_sub_group_size(32)]]). Work-item sub-group membership and execution order are implementation-defined.

Interactive Map · Click Any Level (1–4) or Toggle Intel Sub-group Size
Sub-group (SIMD):
NVIDIA CUDA · kernel<<<2, 128>>> Warp 0 = 4×8 (32 Threads)
1. Grid (2 Thread Blocks · 256 Threads Total) Global Memory
2. Block 0 (blockIdx.x = 0 · Threads T0..T127) → scheduled onto an SM (Streaming Multiprocessor) 128 Threads
3. Warp 0 (Expanded 4×8 Matrix: Threads T0..T31) lane 0..31
Warp 1 · Threads T32..T63
Warp 2 · Threads T64..T95
Warp 3 · Threads T96..T127
2. Block 1 (blockIdx.x = 1 · Threads T128..T255) → SM (Streaming Multiprocessor) assigned at runtime Warps 0..3 (4 × 32 Threads)
Intel SYCL · nd_range<3>: 1×1×256 / 1×1×128 Sub-group 0 = 4×8 (32 Work-Items)
1. ND-Range (N-Dimensional Range: Global=256, Local=128 · 2 Work-Groups) Global USM (Unified Shared Memory)
2. Work-Group 0 (group = 0 · Work-Items WI 0..127) → scheduled onto an Xe-core 128 Work-Items
3. Sub-group 0 (Expanded 4×8 Matrix: Work-Items WI 0..31) lane 0..31
2. Work-Group 1 (group = 1 · Work-Items WI 128..255) → Xe-core assigned at runtime Sub-groups 0..3 (4 × 32 Work-Items)
T0..T31: CUDA Threads 0..31 WI 0..31: SYCL Work-Items 0..31 SG: Sub-group WG: Work-Group ND-Range: N-Dimensional Range SIMD: Single Instruction, Multiple Data SM: Streaming Multiprocessor USM: Unified Shared Memory

Block and work-group IDs (identifiers) are logical indices, not physical SM (Streaming Multiprocessor) or Xe-core IDs. Hardware placement depends on runtime scheduling and available resources.

4.1.1 Visual Guide to sycl::nd_range<3> (3D N-Dimensional Range)

Three visual differences explain why <<<2, 128>>> becomes nd_range<3>{{1,1,256}, {1,1,128}}:

1. Argument 1: Total Workers vs. Block Count global = grid × block
CUDA <<<grid, block>>> grid = 2 , block = 128
⬇ multiply 2 × 128 = 256 (must divide evenly)
SYCL nd_range{global, local} global = 256 , local = 128
2. 3D Axis Flip: CUDA (x,y,z) ↔ SYCL (d0,d1,d2) d0..d2 = dimensions 0..2
CUDA dim3x = 128 (fast)y = 1z = 1SYCL ranged0 (z) = 1d1 (y) = 1d2 (x) = 128
3. 3D (Three-Dimensional) CUDA-Port Convention (used above) nd_range<3>{{1,1,256}, {1,1,128}} → item.get_global_id(2)
≡ 1D shortcut ≡
Pure 1D (One-Dimensional) SYCL (no dummy 1s needed) nd_range<1>{256, 128} → item.get_global_id(0)

4.2 Work-Item Indexing: Which Output Does Each Worker Compute?

3D (Three-Dimensional) dimension mapping: Because CUDA dim3(x, y, z) maps to SYCL sycl::range<3>(d0, d1, d2) (dimensions 0, 1, and 2) as (z, y, x), the contiguous CUDA x axis corresponds to SYCL dimension 2: blockIdx.x maps to item.get_group(2) and threadIdx.x maps to item.get_local_id(2).

Take the same indexing operation from both kernel bodies: const int i = blockIdx.x * blockDim.x + threadIdx.x; in CUDA and const std::size_t i = item.get_global_id(2); in SYCL. For example, block/work-group 1 and local thread/work-item 7 both compute i = 1 × 128 + 7 = 135 and write c[135].

NVIDIA CUDAIntel SYCL (sycl::nd_item<3> item)Meaning (for 256 Total, 2 Groups of 128)
blockIdx.xitem.get_group(2)Work-group index (0 or 1)
threadIdx.xitem.get_local_id(2)Position within one work-group (0..127)
blockIdx.x * blockDim.x + threadIdx.xitem.get_global_id(2)Global element index (0..255)

5. Takeaways

  1. Same workload, different APIs (Application Programming Interfaces): CUDA and SYCL both add two arrays of 256 elements using two groups of 128 workers. Both programs follow the same six stages: setup, allocate, initialize, launch and synchronize, verify, and clean up.
  2. Grid and block mapping: CUDA passes block count and block size to <<<grid, block>>> in (x, y, z) order; SYCL passes total work-items (grid * block) and work-group size to sycl::nd_range<3> (3D N-Dimensional Range) in C++ row-major (d0, d1, d2) = (z, y, x) order (or sycl::nd_range<1> for pure 1D launches).
  3. Execution hierarchy: CUDA threads, blocks, and warps correspond conceptually to SYCL work-items, work-groups, and sub-groups. CUDA warps are fixed at 32 threads, whereas SYCL sub-group SIMD (Single Instruction, Multiple Data) width depends on the target Intel GPU and compiler (such as 16 or 32).

Official References and Notices

Personal blog disclaimer: This article reflects my personal views and technical understanding. It is not an official Intel publication and does not represent the views, positions, or endorsements of Intel Corporation.