-
Notifications
You must be signed in to change notification settings - Fork 108
Add LruFusionCache when direct bindings is used #2806
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
954fbf1
fa29d3b
989273a
f3aedb6
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 |
|---|---|---|
|
|
@@ -71,7 +71,7 @@ | |
| # NOTE This impl file is here because nvFuser may not be available, so it's imported conditionally | ||
| # by nvfuserex.py when nvFuser is available. | ||
|
|
||
| DIRECT_BINDINGS_SUPPORTED_VERSION = LooseVersion("0.2.34") | ||
| DIRECT_BINDINGS_SUPPORTED_VERSION = LooseVersion("0.2.35") | ||
| DTENSOR_SUPPORTED_VERSION = LooseVersion("0.2.28") | ||
| if nvfuser_version() >= DIRECT_BINDINGS_SUPPORTED_VERSION: | ||
| import nvfuser_direct as nvfuser | ||
|
|
@@ -298,6 +298,17 @@ def multidevice_schedule(fd: FusionDefinition, in_dtensors: list[Proxy]) -> None | |
| in_tv.set_allocation_domain(in_tv.get_loop_domain(), new_contiguity=True) | ||
|
|
||
|
|
||
| # This function wraps nvfuser_direct's LruFusionCache with a version check. | ||
| def FusionCacheDecorator(func: callable): | ||
| # For legacy bindings, the decorator does nothin. | ||
| if nvfuser_version() < DIRECT_BINDINGS_SUPPORTED_VERSION: | ||
| return func | ||
| from nvfuser_direct import LruFusionCache | ||
|
|
||
| return LruFusionCache(max_fusions=16384)(func) | ||
|
Collaborator
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. Default value for
Collaborator
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. qq: will there be an option of setting cache size? Or it would not be that useful
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. Usually we pick a reasonable number to avoid out-of-memory issues. We never thought to change it at runtime. |
||
|
|
||
|
|
||
| @FusionCacheDecorator | ||
| def create_fd( | ||
| bsyms: list[BoundSymbol], | ||
| input_descriptors: Sequence[type | tuple[tuple[int, ...], tuple[bool, ...], tuple[int, ...]]], | ||
|
|
||
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.
Is this the minimum version which ships with LruFusionCache?
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.
Yes