You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to print kv cache value for debug, and I noticed T.evaluate function can help me print some message as below
`
@T.prim_func
def test_evaluate(var_a: T.handle, var_b: T.handle):
T.func_attr({"global_symbol": "test_evaluate", "tir.noalias": T.bool(True)})
n = T.int32()
a = T.match_buffer(var_a, (n,), "float32")
b = T.match_buffer(var_b, (n,), "float32")
T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", a, "a"))
T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", b, "b"))
T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", a.shape[0], "a shape[0]"))
T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", a.dtype, "a dtype"))
T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", b.shape[0], "b shape[0]"))
T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", b.dtype, "b dtype"))
for i in T.serial(n):
b[i] = a[i] + 1.0
`
this test code can print message if I run it alone, but when I use T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", a, "a")) in python/mlc_llm/nn/kv_cache.py _kv_cache_transpose_append(kv_cache_config: BaseKVConfig) function, after compliation and running, there is no print message. Is there some pipeline delete this line after compilation? If so, how can I modify python/mlc_llm/compiler_pass to allow these message?
The text was updated successfully, but these errors were encountered:
Hi @XJY990705 thank you for asking this. First, may I ask if your local MLC is the latest? The function _kv_cache_transpose_append was moved to python/tvm/relax/frontend/nn/llm/kv_cache.py in TVM source code a while ago for some reason. Besides, I couldn't find BaseKVConfig in the source code, so would you mind pointing to me which _kv_cache_transpose_append(kv_cache_config: BaseKVConfig) you are referring to?
Ideally no changes in compiler_pass is needed I think. So if you can share some more information that would be very helpful.
❓ General Questions
I want to print kv cache value for debug, and I noticed T.evaluate function can help me print some message as below
`
@T.prim_func
def test_evaluate(var_a: T.handle, var_b: T.handle):
T.func_attr({"global_symbol": "test_evaluate", "tir.noalias": T.bool(True)})
n = T.int32()
a = T.match_buffer(var_a, (n,), "float32")
b = T.match_buffer(var_b, (n,), "float32")
`
this test code can print message if I run it alone, but when I use T.evaluate(T.call_packed("tvm.contrib.debugger.debug_print", a, "a")) in python/mlc_llm/nn/kv_cache.py _kv_cache_transpose_append(kv_cache_config: BaseKVConfig) function, after compliation and running, there is no print message. Is there some pipeline delete this line after compilation? If so, how can I modify python/mlc_llm/compiler_pass to allow these message?
The text was updated successfully, but these errors were encountered: