Skip to content

Sync upstream v2.17 to main - #100

Closed
Caozhou1995 wants to merge 20 commits into
flagos-ai:mainfrom
Caozhou1995:sync-upstream-v2.17
Closed

Sync upstream v2.17 to main#100
Caozhou1995 wants to merge 20 commits into
flagos-ai:mainfrom
Caozhou1995:sync-upstream-v2.17

Conversation

@Caozhou1995

Copy link
Copy Markdown
Collaborator

Description

Please include a brief summary of the changes, relevant motivation and context.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@CLAassistant

CLAassistant commented Aug 10, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


FlagScale Agent seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

FlagScale Agent added 6 commits August 10, 2026 04:14
Resolved all 229 conflicts across P0/P1/P2 priorities:
P0 (plugin system): No conflicts - fork's plugin/ directory fully preserved
P1 (4 files): Manual merge preserving fork features + upstream additions
  1. setup.py: Fork plugin build system + upstream NCCL EP support
  2. transformer_engine/__init__.py: Fork plugin patches + upstream NCCL EP version check
  3. transformer_engine/common/__init__.py: Fork skip_cuda_build() + plugin import
  4. transformer_engine/pytorch/__init__.py: Fork torch_nv + upstream tensor/context utilities
P2 (224 files): Accepted upstream version for core library files

Upgrade path: v2.14 -> v2.17
- convert_host_pointers_to_tensor
- get_device_pointer_for_data_and_scales

These bindings were missing in upstream v2.17's pybind.cpp despite the
corresponding C++ implementations existing in utils.cpp.
Applied 18 patches across 6 files to replace hardcoded 'cuda' device strings
with TE_DEVICE_TYPE constant for multi-backend support.

Changes:
- utils.py: 4 patches
- distributed.py: 3 patches
- quantization.py: 6 patches
- quantized_tensor.py: 1 patch
- cpu_offload.py: 1 patch
- jit.py: 3 patches

All files passed Python AST syntax validation.
Added missing import for InstallCommand from setuptools.command.install
to fix NameError during build.
These P2 files were git-added during Stage 3 merge but still contained
conflict markers. Fixed by checking out the upstream v2.17 version for
all affected files:
- 43 source files (transformer_engine/common, pytorch, jax)
- 10 test files
- 4 doc/example files
- 1 empty artifact removed (quantization_nvfp4.py renamed upstream)

64 files changed, accepting upstream version for all.
These files were generated during the v2.17 sync workflow for debugging
and documentation purposes. They should not be part of the final PR.
FlagScale Agent and others added 14 commits August 10, 2026 05:08
- ops.py: Add 15 new API declarations, update 4 existing signatures
- cuda backend: Add 15 new methods, update 4 signatures in cuda.py and register_ops.py
- All vendor backends (enflame/iluvatar/metax/musa/hygon): Add 19 new methods + OpImpl entries

New APIs: splits_to_offsets_multi, copy_data_ptrs_to_device, bulk_allocate,
create_empty_quantized_tensor, group_dequantize, get_grouped_gemm_setup_workspace_size,
multi_tensor_pad_last_dim, multi_tensor_swizzle_scales_for_gemm_,
multi_tensor_transpose_to_bhsd, cusolvermp_ctx_create, cusolvermp_ctx_destroy,
newton_schulz, nvfp4_quantize_with_amax, nvfp4_group_quantize_with_amax,
swizzle_scales_and_pack_ptrs_for_discrete_weights

Modified signatures: group_quantize, bgrad_group_quantize (+tensor_offsets),
clamped_swiglu, clamped_dswiglu (+glu_linear_offset)
The Stage 3 merge overwrote transformer_engine/__init__.py with upstream's
version, losing the fork-specific TE_DEVICE_TYPE='cuda' default and the
te_device_type() helper function. Multiple files depend on these:
- transformer_engine/pytorch/utils.py
- transformer_engine/pytorch/cpu_offload.py
- transformer_engine/pytorch/distributed.py
- transformer_engine/pytorch/jit.py
- transformer_engine/debug/features/utils/stats_buffer.py
- transformer_engine/pytorch/ops/fused/*.py
…Attention

- Replace hardcoded device='cuda' with device=te_device_type() (2 locations)
- Replace is_cuda checks with device.type == te_device_type() (3 locations)
- These changes were lost during v2.17 upstream merge
- Restores multi-backend compatibility from commit 4f54860
- triton/permutation.py: 12 te_device_type() calls restored
- utils.py: 5 te_device_type() calls restored (_empty_tensor, normalize_device, torch_get_autocast_gpu_dtype)
…ntion

- Fix dot_product_attention.py: use 'from transformer_engine import te_device_type' instead of debug_state import
- Add missing import in layernorm_mlp.py
- Add missing import in quantization.py

All imports now follow main branch convention: 'from transformer_engine import te_device_type'
@Caozhou1995
Caozhou1995 deleted the sync-upstream-v2.17 branch August 11, 2026 03:37
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.

2 participants