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.
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.
| Layer | NVIDIA / CUDA Concept | Intel Xe / oneAPI Counterpart | Important Qualification |
|---|---|---|---|
| GPU Architecture | NVIDIA Hopper / Blackwell | Intel Xe2 / Xe3P | Architecture generations—not 1:1 product or sm_XX (Streaming Multiprocessor target) equivalents |
| Programming Model | CUDA C++ language and runtime | Khronos SYCL with Intel oneAPI | Similar parallel execution concepts; SYCL is an open C++ standard |
| Compiler | nvcc (NVIDIA CUDA Compiler) | icpx -fsycl | Intel® oneAPI DPC++/C++ (Data Parallel C++) Compiler—Just-In-Time (JIT) by default, or Ahead-of-Time (AOT) for target GPUs |
| Kernel Dispatch | CUDA 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).
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 Specification | Arc Pro B60 ↗ | Arc Pro B70 ↗ | Intel GPU D-Series (Crescent Island) ↗ |
|---|---|---|---|
| Architecture | Xe2 | Xe2 | Xe3P |
| Target Workload | Workstation & local AI inference | Workstation & local AI inference | Data center AI inference |
| Memory Capacity | 24 GB GDDR6 | 32 GB GDDR6 | Up to 480 GB LPDDR5X |
| Memory Bandwidth | 456 GB/s | 608 GB/s | — |
| Highlighted AI Matrix Formats | FP16 / BF16 / INT8 / INT4 | FP16 / BF16 / INT8 / INT4 | Adds 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.
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.
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_cudavector_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_syclDon'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];
} });
}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.vector_add and list your pointers and scalars (a, b, c, n).item.get_global_id(...) and write your per-worker body—just like a CUDA __global__ kernel.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 Code | CUDA | Intel SYCL |
|---|---|---|
| Allocate A, B, and C in shared memory | cudaMallocManaged | sycl::malloc_shared (Unified Shared Memory, USM) |
| Launch the kernel | vector_add<<<grid, block>>> | vector_add(q, launch, ...) (calls q.parallel_for) |
| Describe the launch | dim3 grid(2,1,1), block(128,1,1) | range<3> grid(1,1,2), block(1,1,128) |
| Wait before reading C | cudaDeviceSynchronize() | 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.
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.
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.
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}}:
2 × 128 = 256 (must divide evenly)nd_range<3>{{1,1,256}, {1,1,128}} → item.get_global_id(2)1s needed)
nd_range<1>{256, 128} → item.get_global_id(0)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 CUDA | Intel SYCL (sycl::nd_item<3> item) | Meaning (for 256 Total, 2 Groups of 128) |
|---|---|---|
blockIdx.x | item.get_group(2) | Work-group index (0 or 1) |
threadIdx.x | item.get_local_id(2) | Position within one work-group (0..127) |
blockIdx.x * blockDim.x + threadIdx.x | item.get_global_id(2) | Global element index (0..255) |
<<<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).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.