-
Notifications
You must be signed in to change notification settings - Fork 450
[Feature] Support message-only debug print #1755
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 all commits
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 | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -94,23 +94,27 @@ def test_debug_print_register_files(): | |||||||||||||||||||||||||||||||||
| debug_print_register_files(16, 16) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| def debug_print_msg(M=16, N=16): | ||||||||||||||||||||||||||||||||||
| def debug_print_msg(M=16, N=16, msg_only=False): | ||||||||||||||||||||||||||||||||||
| dtype = T.float16 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @T.prim_func | ||||||||||||||||||||||||||||||||||
| def program(Q: T.Tensor((M, N), dtype)): | ||||||||||||||||||||||||||||||||||
| with T.Kernel(4, 4, 2, threads=128 * 2) as (bx, by, bz): | ||||||||||||||||||||||||||||||||||
| tid = T.get_thread_binding() | ||||||||||||||||||||||||||||||||||
| if tid == 0: | ||||||||||||||||||||||||||||||||||
| T.print(bx + by + bz, msg="hello world") | ||||||||||||||||||||||||||||||||||
| if msg_only: | ||||||||||||||||||||||||||||||||||
| T.print(msg="hello world") | ||||||||||||||||||||||||||||||||||
|
Comment on lines
100
to
+106
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. Silence unused Ruff reports 🔧 Proposed fix `@T.prim_func`
def program(Q: T.Tensor((M, N), dtype)):
+ _ = Q
with T.Kernel(4, 4, 2, threads=128 * 2) as (bx, by, bz):
tid = T.get_thread_binding()
if tid == 0:📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.14.14)101-101: Unused function argument: (ARG001) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||
| T.print(bx + by + bz, msg="hello world") | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| jit_kernel = tilelang.compile(program) | ||||||||||||||||||||||||||||||||||
| profiler = jit_kernel.get_profiler() | ||||||||||||||||||||||||||||||||||
| profiler.run_once() | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| def test_debug_print_msg(): | ||||||||||||||||||||||||||||||||||
| debug_print_msg(16, 16) | ||||||||||||||||||||||||||||||||||
| debug_print_msg(16, 16, msg_only=True) | ||||||||||||||||||||||||||||||||||
| debug_print_msg(16, 16, msg_only=False) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if __name__ == "__main__": | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 647
🏁 Script executed:
rg -n "define TL_DEVICE" src/tl_templates/Repository: tile-ai/tilelang
Length of output: 464
🏁 Script executed:
cat -n src/tl_templates/cuda/debug.h | head -50Repository: tile-ai/tilelang
Length of output: 2770
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 122
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 42
🏁 Script executed:
rg -n "debug_print_msg" src/tl_templates/Repository: tile-ai/tilelang
Length of output: 228
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 716
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 1014
🏁 Script executed:
rg -n "includes.*debug.h" src/Repository: tile-ai/tilelang
Length of output: 42
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 299
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 624
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 613
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 189
🏁 Script executed:
Repository: tile-ai/tilelang
Length of output: 2313
Use
inlineorstatic inlinewithdebug_print_msgfor consistency and to avoid potential device function linkage issues.The function
debug_print_msgis defined as a non-inline, non-template__device__function in a header file. Other device utility functions in the same file (device_assert,device_assert_with_msg) useTL_DEVICEwhich includes__forceinline__, butdebug_print_msglacks this. This inconsistency and the lack of inline annotation can lead to multiple definition issues when the header is included across multiple compilation units. Apply the same inlining pattern as adjacent functions.🔧 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents