Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tilelang/jit/adapter/torch/metal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from functools import wraps
from typing import Callable, Optional, Union
from typing import Callable, Optional, Union, List

import torch
from tvm import tir
Expand All @@ -14,8 +14,8 @@ class MetalKernelAdapter(BaseKernelAdapter):

def __init__(
self,
params: list[KernelParam],
result_idx: list[int],
params: List[KernelParam],
result_idx: List[int],
Comment on lines +17 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Fix correctly resolves Python 3.8 compatibility.

The type annotation changes from list[...] to List[...] directly address the Python 3.8 incompatibility issue. The changes are consistent with the existing codebase patterns shown in the relevant code snippets.

To ensure comprehensive Python 3.8 compatibility across the project, verify that no other files use PEP 585-style generics:


🏁 Script executed:

#!/bin/bash
# Description: Search for PEP 585 style generic annotations that are incompatible with Python 3.8

# Search for common PEP 585 patterns in type annotations
echo "=== Searching for PEP 585-style built-in generics ==="
rg -n --type py -P ':\s*(list|dict|set|tuple|frozenset)\[' --glob '!test*' --glob '!*_test.py'

echo ""
echo "=== Checking for 'from __future__ import annotations' ==="
rg -n --type py 'from __future__ import annotations'

Length of output: 454


🏁 Script executed:

#!/bin/bash
echo "=== Searching for PEP 585-style built-in generics in Python files ==="
rg -n ':\s*(list|dict|set|tuple|frozenset)\[' --glob '**/*.py' --glob '!**/test*' --glob '!**/*_test.py'

Length of output: 1084


One remaining PEP 585 generic in tilelang/layout/fragment.py
Line 35 uses shape: list[int], which will error at runtime on Python 3.8. Replace with List[int] (and import it from typing) or add from __future__ import annotations.

🤖 Prompt for AI Agents
tilelang/layout/fragment.py around line 35: the type annotation uses PEP 585
form "list[int]" which fails on Python 3.8; change the annotation to "List[int]"
and add "from typing import List" to the imports at the top, or alternatively
add "from __future__ import annotations" as the first line of the file to defer
evaluation of annotations; ensure only one of these fixes is applied
consistently and run tests to verify.

# target: Union[str, Target],
func_or_mod: Union[tir.PrimFunc, tvm.IRModule],
# host_mod: Optional[tvm.IRModule] = None,
Expand Down
Loading