-
Notifications
You must be signed in to change notification settings - Fork 53
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
Modify the compile
parameter in baseline benchmarks to executor
#3350
Changes from all commits
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 |
---|---|---|
|
@@ -88,7 +88,7 @@ def test_bcast_add_nvf_benchmark( | |
run_benchmark(benchmark, fd.execute, [bias, x]) | ||
|
||
|
||
@pytest.mark.parametrize("compile", [False, True], ids=["eager", "compile"]) | ||
@pytest.mark.parametrize("executor", ["eager", "torchcompile"]) | ||
@pytest.mark.parametrize("size", generate_input_sizes(dims=2)) | ||
@pytest.mark.parametrize("dtype", FLOAT_DTYPES) | ||
@pytest.mark.parametrize("bcast_axis", [0, 1], ids=["outer", "inner"]) | ||
|
@@ -101,9 +101,9 @@ def test_bcast_add_baseline_benchmark( | |
dtype: torch.dtype, | ||
bcast_axis: int, | ||
contiguous: bool, | ||
compile: bool, | ||
executor: str, | ||
): | ||
if compile: | ||
if executor == "torchcompile": | ||
clear_dynamo_cache() | ||
bias = torch.randn(size[1 - bcast_axis], dtype=dtype, device="cuda") | ||
input_shape = size if contiguous else (size[1], size[0]) | ||
|
@@ -112,9 +112,14 @@ def test_bcast_add_baseline_benchmark( | |
x = x.t() | ||
assert x.is_contiguous() == contiguous | ||
|
||
benchmark_fn = { | ||
"eager": bcast_add_fwd_fn, | ||
"torchcompile": torch.compile(bcast_add_fwd_fn), | ||
} | ||
Comment on lines
+115
to
+118
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. Personally I'd avoid using pure strings as much as possible because it'd be difficult to debug when things don't work as intended. For example, I suppose you won't get any error even if you typed "torch.compile". Not a request to change anything, but just my two cents. 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. we 've seen a similar typo err where 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. Agreed, I considered using enums, but the misspelling can cause errors with that too. Please let me know if you have any suggestions which may be more error-proof. |
||
|
||
# Inputs and outputs are same as nvFuser, no need for manual IOByte computation | ||
run_benchmark( | ||
benchmark, | ||
torch.compile(bcast_add_fwd_fn) if compile else bcast_add_fwd_fn, | ||
benchmark_fn[executor], | ||
[bias, x, bcast_axis], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest adding a check ensure
executor
is one of"eager", "torchcompile", "thunder"
to avoid typo, e.g. "torchcompile" -> "torch.compile"