-
Notifications
You must be signed in to change notification settings - Fork 662
[Cache] Introduce detailed target information for the disk kernel cache #780
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
Changes from 1 commit
287bf3a
5f44aef
b2e85c0
aeff94d
200e366
0b4dc07
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,7 +34,7 @@ def compile( | |||||||||||||||||
| out_idx: Union[List[int], int, None] = None, | ||||||||||||||||||
| execution_backend: Literal["dlpack", "ctypes", "cython", "nvrtc"] = "cython", | ||||||||||||||||||
| target: Union[str, Target] = "auto", | ||||||||||||||||||
| target_host: Union[str, Target] = None, | ||||||||||||||||||
| target_host: Union[str, Target, None] = None, | ||||||||||||||||||
| verbose: bool = False, | ||||||||||||||||||
| pass_configs: Optional[Dict[str, Any]] = None, | ||||||||||||||||||
| compile_flags: Optional[Union[List[str], str]] = None, | ||||||||||||||||||
|
|
@@ -69,6 +69,10 @@ def compile( | |||||||||||||||||
| assert isinstance(func, PrimFunc), f"target function must be a PrimFunc but got {type(func)}" | ||||||||||||||||||
| if isinstance(compile_flags, str): | ||||||||||||||||||
| compile_flags = [compile_flags] | ||||||||||||||||||
|
|
||||||||||||||||||
| # This path is not a performance critical path, so we can afford to convert the target. | ||||||||||||||||||
| target, target_host = Target(target), Target(target_host) if target_host else None | ||||||||||||||||||
|
|
||||||||||||||||||
|
Comment on lines
+72
to
+76
Contributor
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. Do not convert the 'auto' sentinel into a TVM Target; this will fail.
Apply: - # This path is not a performance critical path, so we can afford to convert the target.
- target, target_host = Target(target), Target(target_host) if target_host else None
+ # Normalize targets for caching while preserving the 'auto' sentinel.
+ if not isinstance(target, Target) and not (isinstance(target, str) and target == "auto"):
+ target = Target(target)
+ if target_host is not None and not isinstance(target_host, Target):
+ target_host = Target(target_host)Optionally, to centralize validation/coercion, consider using 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| return cached( | ||||||||||||||||||
| func=func, | ||||||||||||||||||
| out_idx=out_idx, | ||||||||||||||||||
|
|
||||||||||||||||||
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.
This line will cause a runtime error when
targethas its default value of"auto". Thetvm.target.Targetconstructor does not support the"auto"keyword and will raise an exception. The logic to resolve"auto"into a concrete target (e.g.,"cuda"or"hip") needs to be executed before creating theTargetobject. This logic appears to exist in thedetermine_targetutility function, which should be used here. A similar issue exists fortarget_hostif it is set to"auto".Note: You will need to add
from tilelang.utils.target import determine_targetto the file's imports for the suggestion to work.