Skip to content

Add support for Torch 2.14 (2.14-rc6) - #784

Merged
danieldk merged 8 commits into
mainfrom
torch-2.14-rc
Aug 25, 2026
Merged

danieldk merged 8 commits into
mainfrom
torch-2.14-rc

Conversation

@danieldk

Copy link
Copy Markdown
Member

Mostly smooth sailing, except ROCm 7.14, which will be added in a subsequent PR.

@danieldk
danieldk marked this pull request as draft August 25, 2026 09:24
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@danieldk
danieldk marked this pull request as ready for review August 25, 2026 10:24
@github-actions

Copy link
Copy Markdown

Coverage report — kernels/

Measured on: Python 3.10 / Torch 2.13.0.
Other CI configurations are not included in this number.
Hardware-gated code paths (ROCm/XPU/NPU/Darwin/Windows) are excluded or unreachable on the Linux+CUDA runner.

Total coverage: 84.9% — threshold: 80% — ✅

Per-file breakdown
Name Stmts Miss Cover Missing
src/kernels/__init__.py 14 0 100%
src/kernels/_system.py 6 1 83% 10
src/kernels/_versions.py 78 14 82% 47, 53-54, 57-58, 96-104, 119, 130
src/kernels/backends.py 212 62 71% 40, 44, 48-51, 68, 90, 108, 117, 121, 125-127, 148, 157, 161, 165-167, 188, 199, 201, 208-211, 224, 228, 232-252, 260, 283-303
src/kernels/compat.py 8 1 88% 5
src/kernels/deps.py 67 12 82% 46-50, 56-70, 75-82
src/kernels/hf_hub.py 62 5 92% 18, 20, 114, 136-137
src/kernels/importer.py 48 3 94% 110, 114, 117
src/kernels/install.py 50 5 90% 78, 116-117, 155, 173
src/kernels/layer/__init__.py 6 0 100%
src/kernels/layer/_interval_tree.py 103 4 96% 23, 52, 147, 150
src/kernels/layer/device.py 48 14 71% 42, 47-49, 91, 96-98, 101, 149, 152, 155-157
src/kernels/layer/func.py 83 7 92% 85, 116, 188, 306, 312, 325, 343
src/kernels/layer/globals.py 5 0 100%
src/kernels/layer/kernelize.py 74 8 89% 255, 281, 289-290, 296, 300, 316-318
src/kernels/layer/layer.py 212 16 92% 172, 215, 221, 234, 342, 422-423, 435, 444, 452, 463, 492, 496, 509, 562, 592
src/kernels/layer/mode.py 14 0 100%
src/kernels/layer/repos.py 144 42 71% 27, 33, 36-43, 63-64, 70, 73-76, 90, 94, 103-104, 110, 113-116, 123-124, 130, 133-136, 143-144, 150, 153-156, 163-164, 170, 173-176, 257
src/kernels/load.py 74 9 88% 232, 238, 244-245, 266-278
src/kernels/locking.py 109 70 36% 43-110, 114-137, 145, 149-156, 160-170, 174-181
src/kernels/python_deps.py 58 4 93% 59-60, 101, 104
src/kernels/resolver.py 135 6 96% 41, 54-70, 174, 180
src/kernels/status.py 49 2 96% 23, 81
src/kernels/variants.py 278 19 93% 64, 95, 116, 146, 255-256, 298-301, 303, 387-394, 400-406, 437-443, 455-461
src/kernels/verify.py 88 1 99% 32
TOTAL 2025 305 85%

Updated by the Test kernels workflow on commit b646a923f82f634feeec40ee53084c7926bbbe80.


triton-xpu_3_8_0 = generic {
version = "3.8.0";
url = "https://huggingface.co/buckets/danieldk/pytorch-rc/resolve/2.14.0/rc6/triton_xpu-3.8.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should maybe start hosting these under kernels-community buckets.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, let's do that for the next RC going forward.

effectiveStdenv ? if cudaSupport then cudaPackages.backendStdenv else stdenv,
}:
let
inherit (lib) versionAtLeast;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@danieldk
danieldk merged commit 081dcd4 into main Aug 25, 2026
54 of 55 checks passed
@danieldk
danieldk deleted the torch-2.14-rc branch August 25, 2026 11:28
danieldk pushed a commit that referenced this pull request Oct 24, 2026
Two independent problems make the published XPU kernels slow. Both are
in `dep-sycl-tla.cmake`.

End-to-end result for `flash-attn2`, built through the normal `nix build
.#redistributable.torch214-xpu20261-x86_64-linux` path. Intel Arc Pro
B60, torch 2.14.0+xpu, fp16, causal, cold compiler cache. Baseline is
the same build with sycl-tla pinned back to v0.8, i.e. the behaviour
before the regression; all three columns are full 86-TU builds with
identical AOT targets, so the only difference is what this PR changes.
Throughput relative to that baseline, higher is better:

| B x S x H x D | before the regression | Hub today | this PR |
|---|---|---|---|
| 4x512x8x64 | 1.00x | 0.56x | 0.90x |
| 4x1024x8x64 | 1.00x | 0.32x | 0.87x |
| 4x2048x8x64 | 1.00x | 0.12x | 0.81x |
| 4x2048x16x64 | 1.00x | 0.11x | 0.80x |
| 8x1024x8x64 | 1.00x | 0.21x | 0.83x |
| 1x4096x32x128 | 1.00x | 0.11x | 1.06x |
| 4x2048x16x96 | 1.00x | 0.08x | 0.78x |
| 4x2048x8x192 | 1.00x | 0.42x | 1.00x |
| 1x4096x32x192 | 1.00x | 0.16x | 1.01x |
| first call | 1.00x | 0.07x | 0.93x |

That is a 2.4x to 9.3x gain over the artifact users get today, and lands
between 0.78x and 1.06x of pre-regression throughput. The remainder is
v0.9.3 itself, which is still slightly behind v0.8 at head_dim 64 and
96; it is not something this PR can close, and v0.9.3 wins at the larger
head dims.

The rest of this description explains the two causes separately.

## 1. AOT is silently disabled on 2026.1

Two gates match `DPCPP_VERSION` against explicit lists that do not
include `2026.1` — the version used by every current XPU variant
(`torch214-xpu20261`, `torch215-xpu20261`).

Missing an entry does not fail the build, it silently drops the AOT
images and the `SPV_INTEL_2d_block_io` /
`subgroup_matrix_multiply_accumulate` extensions. Kernels that use
`XE_2D_*` fail to link (exit code 18); kernels that don't, like
`flash-attn2`, just ship JIT-only.

```diff
-if(DPCPP_VERSION STREQUAL "2026.0")
+set(DPCPP_AOT_MIN_VERSION "2026.0")
+if(DPCPP_VERSION VERSION_GREATER_EQUAL DPCPP_AOT_MIN_VERSION)

-if(DPCPP_VERSION STREQUAL "2025.2" OR ... STREQUAL "2026.0" OR SYCL_TLA_REVISION STREQUAL "v0.5")
+set(DPCPP_BLOCK_IO_MIN_VERSION "2025.2")
+if(DPCPP_VERSION VERSION_GREATER_EQUAL DPCPP_BLOCK_IO_MIN_VERSION OR SYCL_TLA_REVISION STREQUAL "v0.5")
```

Both lists were already contiguous ranges, so this is
behaviour-preserving for every version in `build-variants.json` and
additionally fixes 2026.1. New DPC++ releases now opt *out* of AOT
rather than opt in. `preamble.cmake` enables AOT by default for XPU;
this gate is the only place that turns it back off.

I added the AOT gate in #734, when `2026.0` was the only XPU version
that existed. 2026.1 landed six days later in #784, which didn't touch
this file.

Probe kernel on `torch214-xpu20261-x86_64-linux`, before and after:

```
before:  RequiresExtension: SPV_INTEL_2d_block_io
         icpx: error: llvm-spirv command failed with exit code 18

after:   [16] __CLANG_OFFLOAD_BUNDLE__sycl-spir64_gen   <- AOT
         [17] __CLANG_OFFLOAD_BUNDLE__sycl-spir64       <- JIT fallback
```

For `flash-attn2` this is a first-call effect: **2023.9 ms -> 147.8 ms**
on a cold compiler cache. It does not change steady-state kernel time —
that is problem 2.

## 2. sycl-tla v0.9.2 has a flash-attention forward regression

v0.9.2 rewrote the FMHA forward mainloop and regressed throughput on
Intel GPUs by up to 9x. It is fixed in v0.9.3.

Same flash-attn2 sources, same compiler, same flags, same card (Arc Pro
B60), cold cache. The only variable is the sycl-tla include path. fp16,
causal, head_dim 64. Throughput relative to v0.8, higher is better:

| B x S x H x D | v0.8 | v0.9.2 | v0.9.3 |
|---|---|---|---|
| 4x512x8x64 | 1.00x | 0.63x | 0.91x |
| 4x1024x8x64 | 1.00x | 0.43x | 1.52x |
| 4x2048x8x64 | 1.00x | **0.12x** | 0.91x |
| 4x2048x16x64 | 1.00x | **0.11x** | 0.89x |
| 8x1024x8x64 | 1.00x | 0.19x | 0.90x |

v0.9.2 drops to a ninth of v0.8 throughput at 2048, and the gap grows
with sequence length. v0.9.3 is back to roughly v0.8 and is 1.5x faster
at 1024.

These three builds are a reduced configuration — forward only, head_dim
64 — so that the sycl-tla revision is the single variable. The published
`kernels-community/flash-attn2` `torch214-xpu20261` artifact pins
kernel-builder at `d054906`, which resolves to v0.9.2, and measures in
line with the v0.9.2 column.

The revision is pinned in two places, both bumped to v0.9.3:

- `kernel-builder/src/pyproject/templates/xpu/dep-sycl-tla.cmake`
- `nix-builder/pkgs/xpu-packages/sycl-tla.nix`

`cri` kernel support is retained — v0.9.3 was verified to compile for
the `pvc`, `bmg-g21` and `cri` AOT targets.

The sycl-tla revision gate keeps its explicit list — its fall-through is
`FATAL_ERROR`, so it can't be forgotten silently.

## Notes

Numerics unchanged (`max|diff|` ~1.2e-4 vs torch SDPA flash backend).

AOT images cost build time and artifact size; the `spir64` JIT image is
kept as a fallback for devices outside the AOT list.

Existing kernels won't pick this up until they bump their `flake.lock` —
`kernels-community/flash-attn2` currently pins kernel-builder at
`d054906` — and are rebuilt.

This branch was previously deployed

1 inactive deployment
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.

3 participants