Repository navigation
feat: add an XPU graph backend #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
baf106c
feat: add an XPU graph backend
lslusarczyk e6e6fae
fix(checkpoint): leave out samples a checkpoint cannot hold (#37)
lslusarczyk 984ba8d
fix(inspecting): name wrapped modules by object path (#35)
lslusarczyk 97c7de9
chore(deps): bump pillow version to 13.0.0 (#40)
lukaszstolarczuk bd630e8
docs: address review comments on the XPU graph backend
lslusarczyk 6b73c61
feat(xpu-graph): fall back to eager and try the graph first
lslusarczyk 94f13e3
test(xpu-graph): fail a replay test that runs the original module
lslusarczyk e3670db
perf(xpu-graph): flatten inference inputs once
lslusarczyk 1ec330b
test(xpu-graph): drop a redundant fallback check
lslusarczyk c6ecfcc
test(xpu-graph): fold the larger batch checks into test_tune_module
lslusarczyk 3f20f24
docs: list the XPU graph backend in the dry run log
lslusarczyk 2f429f3
Merge branch 'main' into graph
lslusarczyk 94ac61b
Merge branch 'main' into graph
lslusarczyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <!-- | ||
| Copyright (c) 2026 Intel Corporation | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| # XPU Graph Backend API | ||
|
|
||
| ## XPUGraphBackend | ||
|
|
||
| ::: torch_tweak.torch.backend.XPUGraphBackend | ||
| options: | ||
| show_root_heading: true | ||
| heading_level: 3 | ||
|
|
||
| ## XPUGraphBackendConfig | ||
|
|
||
| ::: torch_tweak.torch.backend.XPUGraphBackendConfig | ||
| options: | ||
| show_root_heading: true | ||
| heading_level: 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <!-- | ||
| Copyright (c) 2026 Intel Corporation | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| # XPU Graph Backend Guide | ||
|
|
||
| The XPU graph backend records the module on an Intel GPU once during tuning and replays that recording on later inference calls. | ||
| Recording is not repeated for each inference call. | ||
|
|
||
| ## Overview | ||
|
|
||
| - **One recording**: warmup and capture run in `build`, while the module is being tuned | ||
| - **Replay**: inference copies new tensor values into the recorded inputs and calls `replay` | ||
| - **Rejection**: a failed recording, an empty recording, or outputs that disagree with eager drop this backend for that module and input | ||
| - **Static shapes**: a batch axis or another dynamic axis rejects the backend. Replay cannot change tensor shapes | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```python | ||
| from torch_tweak.torch.backend import XPUGraphBackend | ||
| from torch_tweak.torch.tune_strategy import HighestThroughputStrategy | ||
|
|
||
| strategy = HighestThroughputStrategy(backends=[XPUGraphBackend()]) | ||
| ``` | ||
|
|
||
| The backend is in the default `FirstWinsStrategy` and `HighestThroughputStrategy` lists, directly after Torch Inductor. | ||
|
|
||
| PyTorch records a native SYCL graph when it was built with a SYCL compiler of 2026.1 or newer, except on PVC. | ||
| An older build records the legacy SYCL command graph. | ||
| This backend uses the recording that build already performs. | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - API reference: [XPU Graph Backend](../../api/backends/xpu_graph_backend.md) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.