Skip to content

fix msvc linker bug for huge command line arguments#406

Open
astrelsky wants to merge 4 commits intopypa:mainfrom
astrelsky:msvc_linker_long_cmdline
Open

fix msvc linker bug for huge command line arguments#406
astrelsky wants to merge 4 commits intopypa:mainfrom
astrelsky:msvc_linker_long_cmdline

Conversation

@astrelsky
Copy link
Copy Markdown

Fixes #226 and pypa/setuptools#4177

This is one of two issues that is blocking flash-attention using ROCM CK on Windows. The other issue is in CK itself and not a pypa problem.

This is just to make it easier for the flash-attention maintainers to find when looking through their comments.
Dao-AILab/flash-attention#2400

@0xDELUXA
Copy link
Copy Markdown

0xDELUXA commented Apr 3, 2026

It’s a bit concerning to see that the last commit was 2 months ago - is the project still actively maintained?

@astrelsky
Copy link
Copy Markdown
Author

@abravalheri @zooba may you get someone to review this please? I only opened this here instead of in setuptools since it was requested to report the issue here in distutils.

The problem is not file path length, it is command line length. So if you're linking thousands of files it doesn't matter how short your paths are, you're going to run out of space.

Comment thread distutils/compilers/C/msvc.py Outdated
@astrelsky astrelsky requested a review from isuruf April 3, 2026 18:22
Comment thread distutils/compilers/C/msvc.py Outdated
Co-authored-by: Isuru Fernando <isuruf@gmail.com>
@0xDELUXA
Copy link
Copy Markdown

0xDELUXA commented Apr 3, 2026

@isuruf Thanks for the review!

Could someone with merge rights take a quick look as well?

@jammm
Copy link
Copy Markdown

jammm commented Apr 28, 2026

@isuruf can we merge this PR please?
@astrelsky @0xDELUXA I've asked internally to reach out and try and get this PR merged.

@jammm
Copy link
Copy Markdown

jammm commented Apr 28, 2026

@astrelsky btw, even after this PR is merged, it'll take a while to percolate. I'm wondering if it makes sense to have another PR within flash-attention itself to use a similar txt/rsp file instead of a commandline string which can workaround the issue until this fix exists everywhere?

Copy link
Copy Markdown
Contributor

@zooba zooba left a comment

Choose a reason for hiding this comment

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

Approach is fine to me, a few things for you to check. Also, these are typically called "response files", so if you wanted to update variable names to make it more obvious that you know what you're doing, that won't hurt.

I'm not in a position to merge it.

Comment thread distutils/compilers/C/msvc.py Outdated
Comment thread distutils/compilers/C/msvc.py Outdated
Comment thread distutils/compilers/C/msvc.py Outdated
Comment thread distutils/compilers/C/msvc.py Outdated
@astrelsky
Copy link
Copy Markdown
Author

Pushing up the changes shortly. I'm not going to bother with the variable names and think the links are enough. I think referring to it as a response file would be more confusing even though that is technically what they are called.

@astrelsky
Copy link
Copy Markdown
Author

astrelsky commented Apr 29, 2026

@astrelsky btw, even after this PR is merged, it'll take a while to percolate. I'm wondering if it makes sense to have another PR within flash-attention itself to use a similar txt/rsp file instead of a commandline string which can workaround the issue until this fix exists everywhere?

I anticipated a lengthy timeline on this. I actually encountered this same problem and fixed it several years ago but neglected to submit a fix and just patched around it.

@astrelsky astrelsky force-pushed the msvc_linker_long_cmdline branch from 17affa1 to 11eb104 Compare April 29, 2026 21:19
@0xDELUXA
Copy link
Copy Markdown

ROCm/xformers#86 also needs this change.

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.

Distutils passes too long a command to link.exe, causing [WinError 206] The filename or extension is too long

5 participants