-
Notifications
You must be signed in to change notification settings - Fork 805
[PyTorch] [torch.compile] torch.compile support for Linear #3053
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
base: main
Are you sure you want to change the base?
Changes from all commits
c6544d0
dfa79c2
116d477
dc4ff77
250bd71
39d10f8
2c37350
eb3f50f
9695013
c64a0b0
b9bf693
aeb3481
53b811b
948f94e
872387f
dcc3c9a
d87eda6
1950585
9c4fadf
a8e4fb7
f47a637
23b093d
e5a8ba8
2ff3301
def2516
1d1ba9b
1822afc
dc5cecd
6586d59
da11b9a
95d5271
0e9e1be
e6b847e
1a00946
c095582
0dcaadd
577b307
ff8bf74
31b385e
3bdce4e
47fee78
6815201
db8c13c
43a0783
0dc980a
355a2cd
d3f6849
1fe48cd
727def7
97825f3
97bb4be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,8 @@ def _run_layer_with_overlap( | |
| quantization, | ||
| num_layers=1, | ||
| use_cublasmp=False, | ||
| use_compile=False, | ||
| compile_mode="default", | ||
| ): | ||
| test_path = TEST_ROOT / "run_layer_with_overlap.py" | ||
| test_cmd = LAUNCH_CMD + [ | ||
|
|
@@ -129,6 +131,10 @@ def _run_layer_with_overlap( | |
| if overlap_rs_dgrad: | ||
| test_cmd.append("--overlap-rs-dgrad") | ||
|
|
||
| if use_compile: | ||
| test_cmd.append("--compile") | ||
| test_cmd.append(f"--compile-mode={compile_mode}") | ||
|
|
||
| if fp8: | ||
| if quantization in ("fp8_delayed_scaling", "fp8_current_scaling") and not fp8_available: | ||
| pytest.skip(reason_for_no_fp8) | ||
|
|
@@ -281,6 +287,45 @@ def test_layers_with_overlap_bf16( | |
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("compile_mode", ["default", "reduce-overhead"]) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kind of a general comment, but do we expect to ever see a case that would work under reduce
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The benefit of such approach would be time saved. If torch.compile + TE CI time will be big we may do that.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So did you measure the time increase of the CI due to this PR?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1.5 min for L0(not just this PR, all torch.compile tests), ~5min for L1 |
||
| @pytest.mark.parametrize( | ||
| "quantization", | ||
| [None, "fp8_current_scaling", "mxfp8"], | ||
| ids=["bf16", "fp8_current_scaling", "mxfp8"], | ||
| ) | ||
| @pytest.mark.parametrize( | ||
| "linear_parallel_mode,overlap_rs_dgrad", | ||
| [ | ||
| ("row", False), | ||
| ("column", False), | ||
| ("column", True), | ||
| ], | ||
| ids=[ | ||
| "ROW-PARALLEL", | ||
| "COL-PARALLEL - BULK DGRAD/WGRAD", | ||
| "COL-PARALLEL - DGRAD+RS", | ||
| ], | ||
| ) | ||
| def test_linear_with_overlap_compile( | ||
| linear_parallel_mode, overlap_rs_dgrad, quantization, compile_mode | ||
| ): | ||
| """te.Linear comm+GEMM overlap (Userbuffers) under torch.compile, | ||
| checked numerically against the eager, non-overlap reference.""" | ||
| if quantization is not None and linear_parallel_mode == "row": | ||
| pytest.skip( | ||
| "FP8 row-parallel UB forces differentiable fp8_output, unsupported under compile." | ||
| ) | ||
| _run_layer_with_overlap( | ||
| te.Linear.__name__, | ||
| linear_parallel_mode, | ||
| overlap_rs_dgrad, | ||
| quantization is not None, | ||
| quantization, | ||
| use_compile=True, | ||
| compile_mode=compile_mode, | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("use_cublasmp", (False, True)) | ||
| @pytest.mark.parametrize( | ||
| "quantization", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.