') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Fix CI failure related to bug in MXFP8 copy implementation by vthumbe1503 · Pull Request #2369 · NVIDIA/TransformerEngine · GitHub
Skip to content

Fix CI failure related to bug in MXFP8 copy implementation - #2369

Merged
vthumbe1503 merged 5 commits into
NVIDIA:mainfrom
vthumbe1503:fix_ci_error
Nov 12, 2025
Merged

Fix CI failure related to bug in MXFP8 copy implementation#2369
vthumbe1503 merged 5 commits into
NVIDIA:mainfrom
vthumbe1503:fix_ci_error

Conversation

@vthumbe1503

@vthumbe1503vthumbe1503 commented Nov 11, 2025

Copy link
Copy Markdown
Collaborator

Description

This PR introduced a bug during the last few commits where in, implementation of copy_ method in torch dispatch accessed mxfp8 attributes without checking if the both source and estination tensors are indeed mxfp8.

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:

  • Fix MXFP8 tensor's copy method.

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

vthumbe1503and others added 5 commits November 11, 2025 18:54
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…ne into fix_ci_error
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci L1 pytorch

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Fixed an AttributeError introduced in the FSDP2 support implementation by reordering conditional checks in the copy_ operation handler within MXFP8Tensor.__torch_dispatch__.

Key Changes:

  • Moved rowwise_matches and columnwise_matches evaluations inside the type check block
  • Previously, attribute access on _rowwise_data and _columnwise_data occurred before verifying both src and dst were MXFP8Tensor instances
  • This caused AttributeError when the copy_ operation was invoked with non-MXFP8Tensor objects
  • The fix ensures attributes are only accessed after type validation, preventing runtime errors

The change maintains the same logical flow but correctly guards attribute access with type checks, allowing the code to fall back to base class behavior when tensors don't match expected types.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The fix addresses a clear bug (AttributeError) by properly ordering type checks before attribute access. The logic is identical to the original implementation, just with corrected guard placement. Pre-commit hooks have validated formatting.
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
transformer_engine/pytorch/tensor/mxfp8_tensor.py5/5Fixed AttributeError in copy_ operation by moving attribute access checks inside type validation block

Sequence Diagram

sequenceDiagram
participant Caller
participant MXFP8Tensor
participant torch_dispatch
Caller->>torch_dispatch: copy_(dst, src)
torch_dispatch->>MXFP8Tensor: __torch_dispatch__(copy_.default, ...)
alt Both src and dst are MXFP8Tensor
MXFP8Tensor->>MXFP8Tensor: Check isinstance(src, MXFP8Tensor)
MXFP8Tensor->>MXFP8Tensor: Check isinstance(dst, MXFP8Tensor)
Note over MXFP8Tensor: Type checks pass, safe to access attributes
MXFP8Tensor->>MXFP8Tensor: Check rowwise_matches
MXFP8Tensor->>MXFP8Tensor: Check columnwise_matches
alt Layout matches
MXFP8Tensor->>MXFP8Tensor: Copy rowwise data if present
MXFP8Tensor->>MXFP8Tensor: Copy columnwise data if present
MXFP8Tensor-->>Caller: Return dst
else Layout mismatch
MXFP8Tensor->>torch_dispatch: super().__torch_dispatch__()
torch_dispatch-->>Caller: Default behavior
end
else Type check fails
MXFP8Tensor->>torch_dispatch: super().__torch_dispatch__()
torch_dispatch-->>Caller: Default behavior
end
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@vthumbe1503vthumbe1503 changed the title Fix CI failureFix CI failure related to bug in MXFP8 copy implementationNov 12, 2025

@ksivamanksivaman left a comment

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.

LGTM

@vthumbe1503
vthumbe1503 merged commit f8693d2 into NVIDIA:mainNov 12, 2025
29 of 31 checks passed
Sign up for freeto 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

@vthumbe1503@ksivaman