{"slug": "intel-xe3-vs-apple-m2-bfloat16-gap", "title": "Intel Xe3 vs. Apple M2 bfloat16 gap", "summary": "A PyTorch benchmark comparing an Intel Core Ultra 7 355 with integrated Xe3 GPU (Lenovo Yoga Slim 7 Ultra 14IPH11, Fedora Linux 45) against an Apple M2 (MacBook Air M2, macOS 27.1) found the Xe3 reached 17.30 TFLOPS on a 4096x4096 bfloat16 matmul versus 1.25 TFLOPS for the M2, a 13.8x gap, while the M2 won attention at 195,718 tok/s versus 155,103 tok/s (+26%) and the training step at 17,323 tok/s versus 16,721 tok/s (+4%). The Xe3 also led float32 matmul at 2.51 versus 2.25 TFLOPS (+12%) and MLP forward at 138.8 versus 136.4 iters/s (+2%). On the M2, bfloat16 matmul ran 1.8x slower than float32, and the author published the benchmark code at git.carette.xyz/k0pernicus/laptop_gpu_bench.", "body_md": "# Intel Xe3 vs Apple M2 bfloat16 gap\n\n· 6 min read\n\nI wanted to compare two laptops on different GPU operations, related to deep learning.\n\nThe two laptops I compared are:\n\n- the [MacBook Air M2](https://www.notebookcheck.net/Apple-MacBook-Air-M2-Entry-Review-A-very-good-but-too-expensive-daily-MacBook.636637.0.html) (8 CPU cores: 4 performance + 4 efficiency, 8 GPU cores), 16GB of unified memory — macOS 27.1,\n- the [Lenovo Yoga Slim 7 Ultra 14IPH11](https://www.notebookcheck.net/Lenovo-Yoga-Slim-7-Ultra-14IPH11.1304888.0.html) , with an Intel Core Ultra 7 355 (8 cores: 4P + 4 low-power E) and an integrated Intel Xe3 GPU — Fedora Linux 45 (Silverblue).\n\nTo be honest, I expected both machines to be roughly equal, with a slight advantage for the MacBook Air M2… but that was not the case.\n\nBoth machines run the same PyTorch benchmark script, but the device backend differs: the Yoga uses XPU and the MacBook uses MPS (Metal Performance Shaders).\n\nI wanted to benchmark different parts, so I measured:\n\n- `MatMul` : a 4096x4096 matrix multiplication,\n- `MLP Forward` : a fully-connected forward pass,\n- `Attention` : an attention pass,\n- and `Train Step` : a full forward + backward + optimizer step.\n\nThe code is available [here](https://git.carette.xyz/k0pernicus/laptop_gpu_bench).\n\nThe shapes are shown next to each line, and TFLOPS assume the standard 2·N³ FLOPs for an N×N matmul.\nI benchmarked both float32 and [**bfloat16**](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) (bf16). At that time I forgot float16 (or f16), but I included this format later in this post.\n\n## \n  First results\n  [#](#first-results)\n\nFor those experiments, I unplugged both laptops, and put the battery mode to ‘balanced’ on the Lenovo Yoga, and to ‘standard (no battery saver)’ on the MacBook.\n\nThis is the output for the Lenovo Yoga:\n\n```\nBenchmarking on: xpu\nMatMul 4096x4096 (torch.float32): 54.67 ms/iter | 2.51 TFLOPS\nMatMul 4096x4096 (torch.bfloat16): 7.94 ms/iter | 17.30 TFLOPS\nMLP Forward (256x2048): 7.20 ms/iter | 138.8 iters/s\nAttention (16x1024x1024): 105.63 ms/iter | 155,103 tok/s\nTrain Step (16x1024x1024): 979.87 ms/iter | 16,721 tok/s\n```\n\nand for the MacBook:\n\n```\nBenchmarking on: mps\nMatMul 4096x4096 (torch.float32): 61.11 ms/iter | 2.25 TFLOPS\nMatMul 4096x4096 (torch.bfloat16): 109.59 ms/iter | 1.25 TFLOPS\nMLP Forward (256x2048): 7.33 ms/iter | 136.4 iters/s\nAttention (16x1024x1024): 83.71 ms/iter | 195,718 tok/s\nTrain Step (16x1024x1024): 945.79 ms/iter | 17,323 tok/s\n```\n\nI made this table as a better comparison view:\n\n| Benchmark | Yoga XPU | Mac M2 | Winner | \n|---|---|---|---|\n| MatMul fp32 | 2.51 TFLOPS | 2.25 TFLOPS | Yoga (+12%) | \n| MatMul bf16 | 17.30 TFLOPS | 1.25 TFLOPS | Yoga (13.8x) | \n| MLP forward | 138.8 iters/s | 136.4 iters/s | Yoga (+2%) | \n| Attention | 155,103 tok/s | 195,718 tok/s | Mac (+26%) | \n| Train step | 16,721 tok/s | 17,323 tok/s | Mac (+4%) | \n\nThe Mac wins attention and the training step. The Yoga wins every matmul tested here (fp32, bf16) and the MLP forward pass. The bf16 matmul gap is enormous: 13.8x, or 109.59 ms vs 7.94 ms per iteration. On the M2, bf16 is also 1.8x slower than fp32. The MLP, attention, and training rows are single numbers, not per-format.\n\nAt first, I was confused by the results. How is it possible that bfloat16 operations were so slow on the MacBook?\n\nFirst, let’s explore what is bfloat16, and how it compares to float16 and float32 formats.\n\n## \n  What is bfloat16?\n  [#](#what-is-bfloat16)\n\nbfloat16 stands for **Brain Floating Point**, [a 16-bit format developed by Google Brain](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format).\nLike float16, it halves memory usage compared to float32, but it trades precision for range.\n\nbfloat16 has the same range of values as float32 using half as many bits. That drops decimal precision from ~7 significant digits in float32 to **2 to 3 significant digits** in bfloat16, which makes it an interesting format for deep learning experiments.\n\n| Feature | float32 (FP32) | float16 (FP16) | bfloat16 (BF16) | \n|---|---|---|---|\n| Total Bits | 32 bits | 16 bits | 16 bits | \n| Sign Bit | 1 bit | 1 bit | 1 bit | \n| Exponent Bits (Range) | 8 bits | 5 bits | 8 bits | \n| Mantissa / Fraction Bits (Precision) | 23 bits | 10 bits | 7 bits | \n| Max Representable Value | ~3.4 × 10^38 | ~65,504 | ~3.4 × 10^38 | \n| Smallest Positive Normal | ~1.18 × 10^-38 | ~6.1 × 10^-5 | ~1.18 × 10^-38 | \n| Decimal Precision | ~7 significant digits | ~3–4 significant digits | ~2–3 significant digits | \n\nBut why is bf16 good for deep learning?\n\nFirst, the **range**. The 8-bit exponent matches fp32, so gradients and activations rarely overflow or underflow. Unlike fp16, bf16 does not need loss scaling during training.\n\nThen, the **memory**. 16-bit storage cuts the footprint and memory bandwidth in half compared to fp32.\n\nFinally, the **throughput**. Matrix units such as Intel’s XMX, NVIDIA tensor cores, or TPUs have native bf16 paths, and they usually accumulate in fp32. The fp32 accumulator is what makes the 7-bit mantissa tolerable.\n\nThe trade-off is precision: bf16 has fewer mantissa bits than fp16. For most weights and activations, that is fine, especially with fp32 accumulation. Operations that need more precision (reductions, softmax, normalization) stay in fp32 in a mixed-precision setup.\n\nCrucially, bf16 is only fast when the hardware has a native bf16 path, which is the case only [for the Yoga](https://www.hwcooling.net/en/xe3-whats-new-in-panther-lakes-gpu-architecture-analysis/).\n\nfloat16, meanwhile, has existed for much longer in Apple’s graphics and mobile GPUs, so on M1/M2 hardware fp16 is the fast 16-bit format.\n\n## \n  bfloat16 support on Apple Silicon\n  [#](#bfloat16-support-on-apple-silicon)\n\nThe M1 has no native bf16 support at all. The M2 and M3 CPUs implement the Armv8.6-A instruction set, which includes bf16 instructions.\nMPSGraph has exposed a bf16 data type since [macOS 14 (Sonoma)](https://developer.apple.com/videos/play/wwdc2023/10050), but the M2 GPU has [**no native** bf16 matrix path](https://github.com/deepsweet/metal-fp32-bf16-fp16).\nSo PyTorch’s MPS backend runs bf16 matmuls **by converting the inputs to fp32, computing in fp32, and converting the result back to bf16**.\nThat adds memory traffic and conversion instructions to every operation, which is exactly what the 1.8x slowdown reflects.\nCompared to the MacBook, the Yoga’s Xe3 GPU has [XMX matrix engines with native bf16 support](https://www.hwcooling.net/en/xe3-whats-new-in-panther-lakes-gpu-architecture-analysis/). The M2 GPU has [no dedicated matrix engines](https://developer.apple.com/videos/play/tech-talks/111432) (Apple only added neural accelerators with the M5). That explains the speed-up.\n\nFor context, native bf16 matrix acceleration on the GPU only arrives with the [M5’s neural accelerators](https://developer.apple.com/videos/play/tech-talks/111432).\n\n## \n  Adding float16 to the comparison\n  [#](#adding-float16-to-the-comparison)\n\nI don’t like unfair comparisons, so let me add float16 to the benchmark:\n\n```\nBenchmarking on: xpu # Lenovo Intel Ultra 7\nMatMul 4096x4096 (torch.float16): 9.12 ms/iter | 15.07 TFLOPS\n# ...\nBenchmarking on: mps # MacBook Air M2\nMatMul 4096x4096 (torch.float16): 54.49 ms/iter | 2.52 TFLOPS\n# ...\n```\n\nNow the picture is clearer:\n\n| MatMul 4096x4096 | fp32 | fp16 | bf16 | Best | \n|---|---|---|---|---|\n| Yoga XPU | 2.51 TFLOPS | 15.07 TFLOPS | 17.30 TFLOPS | bf16 (6.9x fp32) | \n| Mac M2 | 2.25 TFLOPS | 2.52 TFLOPS | 1.25 TFLOPS | fp16 (1.12x fp32) | \n\nOn the Yoga, fp16 is 15% slower than bfp16, but 6.9x faster than fp32. On the M2, fp16 is twice as fast as bf16, and slightly faster than fp32. The 13.8x bf16 gap between the two machines shrinks to 6.0x for fp16 and 1.1x for fp32.\n\nSo for matmul workloads, the Yoga is faster across the board (and dramatically so for bf16).\n\n## \n  Conclusion\n  [#](#conclusion)\n\nHere, the practical lesson is to check which format your device actually accelerates before switching your code to it. It seems obvious at first, but let’s keep this in mind: a floating-point format is only fast when the hardware has a native path for it.\n\nIf you want to compare with my results on your own laptop (desktop is cheating…), the code is in my Git repository [here](https://git.carette.xyz/k0pernicus/laptop_gpu_bench).", "url": "https://wpnews.pro/news/intel-xe3-vs-apple-m2-bfloat16-gap", "canonical_source": "https://carette.xyz/posts/intel_xe3_vs_apple_m2_bf16_gap/", "published_at": "2026-12-06 09:58:18+00:00", "updated_at": "2026-12-06 10:15:08.650920+00:00", "lang": "en", "topics": ["machine-learning", "ai-infrastructure", "ai-chips"], "entities": ["Intel", "Intel Xe3", "Apple", "Apple M2", "Lenovo Yoga Slim 7 Ultra 14IPH11", "MacBook Air M2", "PyTorch", "Intel Core Ultra 7 355"], "also_reported_by": [], "takeaway": "On the tested hardware, bfloat16 matmul on Intel Xe3 hit 17.30 TFLOPS versus 1.25 TFLOPS on Apple M2, and bf16 was 1.8x slower than fp32 on the M2, so check per-format throughput before assuming a GPU's mixed-precision speed.", "recommendation": {"advice": "Benchmark bf16 and fp32 matmul separately on each target GPU before choosing a precision; the M2 measured 1.25 TFLOPS in bf16 versus 2.25 TFLOPS in fp32.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/intel-xe3-vs-apple-m2-bfloat16-gap", "markdown": "https://wpnews.pro/news/intel-xe3-vs-apple-m2-bfloat16-gap.md", "text": "https://wpnews.pro/news/intel-xe3-vs-apple-m2-bfloat16-gap.txt", "jsonld": "https://wpnews.pro/news/intel-xe3-vs-apple-m2-bfloat16-gap.jsonld"}}