tilelang.autodd¶
Attributes¶
Classes¶
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Module Contents¶
- tilelang.autodd.ast_replace(node, **changes)¶
- 参数:
node (ast.AST)
- 返回类型:
ast.AST
- tilelang.autodd.parse_stmts(s)¶
- 参数:
s (str)
- 返回类型:
list[ast.stmt]
- tilelang.autodd.parse_expr(s)¶
- 参数:
s (str)
- 返回类型:
ast.expr
- class tilelang.autodd.ASTRewrite¶
Bases:
abc.ABCHelper class that provides a standard way to create an ABC using inheritance.
- abstractmethod get_name()¶
- 返回类型:
str
- abstractmethod match(node, parent, field, inside_list)¶
- class tilelang.autodd.GeneralRemove¶
Bases:
ASTRewriteHelper class that provides a standard way to create an ABC using inheritance.
- name: str¶
- target_type: type[ast.AST]¶
- replace_with: ast.AST | list[ast.AST] | None = None¶
- get_name()¶
- 返回类型:
str
- match(node, parent, field, inside_list)¶
- tilelang.autodd.expr_to_zeros(target)¶
- 参数:
target (ast.expr)
- 返回类型:
ast.expr
- class tilelang.autodd.CallFwdArg1¶
Bases:
ASTRewriteHelper class that provides a standard way to create an ABC using inheritance.
- get_name()¶
- 返回类型:
str
- match(node, parent, field, inside_list)¶
- class tilelang.autodd.AttachFullFuncArgs¶
Bases:
ASTRewriteHelper class that provides a standard way to create an ABC using inheritance.
- get_name()¶
- 返回类型:
str
- match(node, parent, field, inside_list)¶
- class tilelang.autodd.IntConstApply¶
Bases:
ASTRewriteHelper class that provides a standard way to create an ABC using inheritance.
- apply: Callable[[int], ast.AST]¶
- name: str¶
- get_name()¶
- 返回类型:
str
- match(node, parent, field, inside_list)¶
- class tilelang.autodd.BinOpFwdArg¶
Bases:
ASTRewriteHelper class that provides a standard way to create an ABC using inheritance.
- forward: Literal['left', 'right'] = 'left'¶
- get_name()¶
- 返回类型:
str
- match(node, parent, field, inside_list)¶
- tilelang.autodd.ASTPatKind¶
- class tilelang.autodd.ASTPat¶
- tree: ast.expr | list[ast.stmt]¶
- placeholders: set[str]¶
- classmethod from_code(kind, code, placeholders)¶
- 参数:
kind (ASTPatKind)
code (str)
placeholders (set[str])
- 返回类型:
- replace(repl)¶
- 参数:
repl (dict[str, ast.AST])
- 返回类型:
ast.AST
- class tilelang.autodd.ASTPatRewrite¶
Bases:
ASTRewriteHelper class that provides a standard way to create an ABC using inheritance.
- name: str¶
- derived: dict[str, Callable[[dict[str, ast.AST]], ast.AST]] | None = None¶
- classmethod from_code(name, kind, match, rewrite, placeholders, checker=None, derived=None)¶
- 参数:
- 返回类型:
- get_name()¶
- 返回类型:
str
- match_placeholders(node)¶
- 参数:
node (ast.AST)
- match(node, parent, field, inside_list)¶
- class tilelang.autodd.LabeledRewrite¶
- label: int¶
- rewrite: ASTRewrite¶
- class tilelang.autodd.RewriteAttacher(rewrites)¶
Bases:
ASTMutator- 参数:
rewrites (list[ASTRewrite])
- rewrites¶
- uid_counter = 0¶
- rewrite_counter = 0¶
- rewrite_names¶
- tilelang.autodd.attach_rewrites(tree, rewrites)¶
- 参数:
tree (ast.AST)
rewrites (list[ASTRewrite])
- 返回类型:
tuple[ast.AST, int, int]
- class tilelang.autodd.RewriteApplier(target_labels)¶
Bases:
ASTMutator- 参数:
target_labels (set[int])
- target_labels¶
- applied_rewrites: set[int]¶
- visited: set[int]¶
- tilelang.autodd.apply_rewrites(tree, target_labels)¶
- 参数:
tree (ast.AST)
target_labels (set[int])
- 返回类型:
tuple[ast.AST, set[int]]
- tilelang.autodd.test_rewrite(rewrite, code)¶
- 参数:
rewrite (ASTRewrite)
code (str)
- class tilelang.autodd.PDD(all_labels, init_proba=0.93)¶
- 参数:
all_labels (list[int])
init_proba (float)
- all_labels¶
- probas¶
- apply(target_labels)¶
- 参数:
target_labels (set[int])
- 返回类型:
set[int]
- class tilelang.autodd.TaskManager¶
Bases:
abc.ABCHelper class that provides a standard way to create an ABC using inheritance.
- classmethod from_source(source, *args, **kwargs)¶
- Abstractmethod:
- 参数:
source (str)
- 返回类型:
- class tilelang.autodd.ASTPDD(tree, rewrites, init_proba=0.93)¶
Bases:
TaskManager,PDDHelper class that provides a standard way to create an ABC using inheritance.
- 参数:
tree (ast.AST)
rewrites (list[ASTRewrite])
init_proba (float)
- classmethod from_source(source, *args, **kwargs)¶
- apply(target_labels)¶
- 参数:
target_labels (set[int])
- 返回类型:
set[int]
- tilelang.autodd.ruff_fix_code(code_string, fix_lint=True, format_code=True)¶
- class tilelang.autodd.LinePDD(source, init_proba=0.93)¶
Bases:
TaskManager,PDDHelper class that provides a standard way to create an ABC using inheritance.
- 参数:
source (str)
init_proba (float)
- lines¶
- classmethod from_source(source, *args, **kwargs)¶
- class tilelang.autodd.Ruff(source, fix_lint=True, format_code=True)¶
Bases:
TaskManagerHelper class that provides a standard way to create an ABC using inheritance.
- source¶
- fix_lint = True¶
- format_code = True¶
- finished = False¶
- task_generator()¶
- class tilelang.autodd.AsyncPythonRunner¶
- process = None¶
- input_queue = None¶
- output_queue = None¶
- lock¶
- start_proc()¶
- stop_proc()¶
- __enter__()¶
- __exit__(exc_type, exc_value, traceback)¶
- async run(code, timeout=5.0)¶
- 参数:
code (str)
timeout (float)
- class tilelang.autodd.SubProcRunner¶
- __enter__()¶
- __exit__(exc_type, exc_value, traceback)¶
- async run(code, timeout=5.0)¶
- 参数:
code (str)
timeout (float)
- tilelang.autodd.clean_empty_pass(code)¶
- 参数:
code (str)
- 返回类型:
str
- tilelang.autodd.JobBackend¶
- class tilelang.autodd.ParTaskManager¶
- err_msg: str¶
- text: str¶
- output_file: pathlib.Path¶
- timeout: int = 60¶
- num_workers: int = 1¶
- backend: JobBackend = 'runner'¶
- __post_init__()¶
- property text_len¶
- reset(task_manager)¶
- 参数:
task_manager (TaskManager)
- post_proc(text)¶
- async worker(wid)¶
- 参数:
wid (int)
- async start_workers()¶
- async stop_workers()¶
- async run_async(task_manager)¶
- 参数:
task_manager (TaskManager)
- async run_with(cls, *args, **kwargs)¶
- 参数:
cls (type[TaskManager])
- class tilelang.autodd.Args¶
Bases:
NamedTuple- source: pathlib.Path¶
- err_msg: str¶
- output: pathlib.Path¶
- backend: JobBackend¶
- timeout: int¶
- jobs: int¶
- tilelang.autodd.cli_main(argv=None)¶
- 参数:
argv (Sequence[str] | None)
- 返回类型:
None