Repository navigation
Conversation
Register Intel XPU in ROLL's platform abstraction: device detection, the XCCL communication backend, XPU device visibility for Ray workers, and the XPU vLLM worker. Add a supports_tensor_ipc platform flag (default True) so colocated weight updates use the existing broadcast path when tensor IPC is unavailable, and call the CUDA allocator and host-cache APIs only when the PyTorch build provides them. Document the supports_tensor_ipc flag and the Ray visible-device fallback with one-line comments.
Apply the shared Ulysses attention patch in XpuPlatform.apply_ulysses_patch, as the CUDA and ROCm platforms do. Make the flash_attn import in ulysses_attention.py optional: the transformers>=4.53 patch path only needs expandKV from this module, and XPU has no flash_attn package. The transformers<4.53 path raises a clear ImportError when flash_attn is missing.
Madhustat
force-pushed
the
xpu/pr2-ulysses-context-parallel
branch
from
November 27, 2026 06:03
e9f3618 to
f912d52
Compare
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Relates to #525
Depends on #526 (
feat(xpu): add Intel XPU platform support). This PR is stacked on #526; until #526 is merged, the GitHub diff also includes its base platform commit, and the context-parallel change is the final commit in this PR.Summary
Enable ROLL's existing Ulysses context parallel on XPU:
flash_attnimports optional for the Transformers-based Ulysses pathWhen
flash_attnis installed, the existingflash_attnfunctions remain in use. When it is not installed, the module still imports, and only the code path that needsflash_attnraises a clearImportError.Motivation
XpuPlatform.apply_ulysses_patch()currently returns without applying the Ulysses patch, so ROLL falls back to context parallel size 1 even when the configuration setsulysses_size: 2, and logs:ulysses_size in config (2) is not equal to cp_size (1), using cp_size insteadApplying the patch alone is not sufficient because
ulysses_attention.pyimports the standaloneflash_attnpackage at module load time, while that package is not installed in the validated XPU environment.Changes
roll/platforms/xpu.py(added by feat(xpu): add Intel XPU platform support #526):apply_ulysses_patch()calls the sharedroll.utils.context_parallel.apply_ulysses_patch(), ascuda.pyandrocm.pydo.roll/utils/context_parallel/ulysses_attention.py:flash_attnimports intry / except ImportError._flash_attention_forward, used only by the Transformers < 4.53 patch path, raises anImportErrorat entry ifflash_attnis not installed.Validation
XPU: 2 × Intel Arc Pro B70, PyTorch 2.14.0+xpu, vLLM 0.31.0+xpu, Transformers 5.17.0, oneCCL 2022.0.0. With
attn_implementation: fa2, Transformers resolves to the XPU build ofkernels-community/flash-attn2. XPU workflow runs also included #527 and #524; this change does not depend on either.Configurations derived from ROLL examples, reduced to two XPUs and small models, each with a context parallel 1 control:
cp_rmpad(tests/distributed/strategy/log_probs/)In every context parallel 2 run, the Ulysses patch was applied and no
not equal to cp_sizewarning was logged. A two-rank check confirmed that each rank processes half of the sequence and that the all-to-all runs in every attention layer; context parallel 1 and 2 log-probabilities and gradients are equally close to an fp32 reference.NVIDIA:
mainande9f3618fgive matching results on the context-parallel unit tests,cp_rmpad, one context-parallel workflow, and one workflow without context parallel, with the installedflash_attnfunctions in use.Scope
attn_implementation: fa2, Transformers >= 4.53.0 on XPU; lower versions need the standaloneflash_attnpackage.