-
Notifications
You must be signed in to change notification settings - Fork 333
[Feature] Support None type as input for T.ptr and T.Tensor
#1114
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
Conversation
WalkthroughAdds a new test module exercising TileLang JIT tiled GEMM kernels with optional/nullptr bias handling and PyTorch validation; the Cython wrapper now accepts Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test script
participant Builder as JIT kernel builder
participant Cython as Cython wrapper
participant Runtime as Native kernel
participant Ref as PyTorch
Note over Test,Builder: Prepare inputs (A,B,C, Bias or None)
Test->>Builder: build/compile JIT kernel (ptr_null_test / tensor_null_test)
Test->>Cython: invoke kernel with args (some args may be None)
Cython->>Runtime: pass arguments (None -> null pointer)
Runtime-->>Cython: execute tiled GEMM (shared tiles, pipelined K-loop), apply bias if pointer non-null
Cython-->>Test: return output C
Test->>Ref: compute reference (A @ B.T [+ bias])
Test->>Test: compare outputs (validate)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
|
@codex review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if dtype not in dtype_to_ctype: | ||
| raise ValueError(f"Unsupported tensor dtype: {dtype}") | ||
| call_args.append(dtype_to_ctype[dtype](tensor)) | ||
| elif tensor is None: | ||
| call_args.append(ctypes.c_void_p(0)) | ||
| else: | ||
| raise ValueError(f"Unsupported tensor type: {type(tensor)}") | ||
|
|
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.
Handle optional tensors consistently across adapters
Adding elif tensor is None: call_args.append(ctypes.c_void_p(0)) makes the Cython path accept null inputs, but the other adapters (e.g. the ctypes and nvrtc wrappers) still always access .shape/.stride on every argument when building dynamic symbolics. Passing None for a T.ptr/T.Tensor with those backends will therefore still raise an AttributeError instead of forwarding a null pointer, despite the feature claiming generic support for None. To avoid backend‑dependent failures, the same None handling or a guard in their dynamic dimension logic is needed.
Useful? React with 👍 / 👎.
For issue #828
Summary by CodeRabbit
New Features
Tests
Chores