最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - How to use triton.language.device_print for numbers? - Stack Overflow

programmeradmin1浏览0评论

I am using Triton 3.1.0 I need to debug a Triton program by printing something in device code. However, I find that device_print does not accept numbers. Below is a simple example.

import triton
import triton.language as tl

@triton.jit
def kernel():
    pid = tl.program_id(0)
    tl.device_print(pid)

kernel[(1,)]()

It complains "AssertionError: int32[] is not string".

I tried using strings, e.g., "hello", instead of pid in the example. It works.

I tried str() to convert the number to a string. But it fails with "NameError('str is not defined')".

Printing floating numbers, e.g., 3.0, does not work either.

How can we print numbers?

发布评论

评论列表(0)

  1. 暂无评论