You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/09/07 14:39:39 UTC

[GitHub] [incubator-tvm] xqdan opened a new issue #6413: TIR Printer bugs

xqdan opened a new issue #6413:
URL: https://github.com/apache/incubator-tvm/issues/6413


   Thanks for participating in the TVM community! We use https://discuss.tvm.ai for any general usage questions and discussions. The issue tracker is used for actionable items such as feature proposals discussion, roadmaps, and bug tracking.  You are always welcomed to post on the forum first :)
   
   Issues that are inactive for a period of time may get closed. We adopt this policy so that we won't lose track of actionable issues that may fall at the bottom of the pile. Feel free to reopen a new one if you feel there is an additional problem that needs attention when an old one gets closed.
   
   For bug reports, to help the developer act on the issues, please include a description of your environment, preferably a minimum script to reproduce the problem.
   
   For feature proposals, list clear, small actionable items so we can track the progress of the change.
   
   Hi,
   
   I am trying to use tir printer to dump ir for each pass:
   '''
   __TRACE_COUNTER__ = 0
   def dumpir(module, info, is_before):
       global __TRACE_COUNTER__
       if bool(is_before) == False:
           __TRACE_COUNTER__ += 1
           pname = str(__TRACE_COUNTER__).rjust(2,'0')  + "_" + info.name + ".ir"
           with open(pname, "a") as f:
               f.write(str(module))
   
   def tx_conv2d(input_shape, filter_shape, pad, stride):
       fmap = te.placeholder(input_shape, name="feature_map", dtype="float16")
       weight = te.placeholder(filter_shape, name="filter", dtype="float16")
       conv_res = tx_conv_compute(fmap, weight, pad, stride)
       sch = tx_conv2d_schedule(conv_res)
       with tvm.transform.PassContext(opt_level=3, trace=dumpir):
           (tvm.lower(sch, [fmap, weight, conv_res], simple_mode=True))
   '''
   
   1, check failed for local buffer
   https://github.com/apache/incubator-tvm/blob/82d157f0b83ae17fde7bbfca14110aa2f2b80b61/src/printer/tir_text_printer.cc#L196
   
   such as: buffer(result.shared_LLB, 0x11b7170), which is not in buffer_map
   
   2, so I comment this, then I find ir dump for 01_tir.InjectPrefetch.ir, missing buffer for a store name, which looks werid:
   ```
    attr [] "realize_scope" = "shared_LLB";
           realize(, [0:1, 0:1, 0:16, 0:32], True {
             attr [IterVar(ax0_1: int32, (nullptr), "DataPar", "")] "pragma_dma_copy" = 1;
             for (ax2_1: int32, 0, 16) {
               for (ax3_1: int32, 0, 32) {
                 [0, 0, ax2_1, ax3_1] = filter[0, 0, ax2_1, ax3_1]
               }
             }
   ```
   3, is this an extra ')' here ?
   https://github.com/apache/incubator-tvm/blob/82d157f0b83ae17fde7bbfca14110aa2f2b80b61/src/printer/tir_text_printer.cc#L304
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] spectrometerHBH commented on issue #6413: TIR Printer bugs

Posted by GitBox <gi...@apache.org>.
spectrometerHBH commented on issue #6413:
URL: https://github.com/apache/incubator-tvm/issues/6413#issuecomment-688565617


   Thanks for your suggestion! @xqdan 
   
   Is your codebase up-to-date? It seems to me that the source file you referenced is different from that of mainline.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] xqdan closed issue #6413: TIR Printer bugs

Posted by GitBox <gi...@apache.org>.
xqdan closed issue #6413:
URL: https://github.com/apache/incubator-tvm/issues/6413


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] xqdan commented on issue #6413: TIR Printer bugs

Posted by GitBox <gi...@apache.org>.
xqdan commented on issue #6413:
URL: https://github.com/apache/incubator-tvm/issues/6413#issuecomment-688585767


   @spectrometerHBH thanks! I checkout latest version, looks good now, close this now.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] xqdan commented on issue #6413: TIR Printer bugs

Posted by GitBox <gi...@apache.org>.
xqdan commented on issue #6413:
URL: https://github.com/apache/incubator-tvm/issues/6413#issuecomment-688547478


   @spectrometerHBH you can reproduce with 
   ```
   diff --git a/tests/python/unittest/test_te_schedule_tensor_core.py b/tests/python/unittest/test_te_schedule_tensor_core.py
   index ae2301caf..b832a0bce 100644
   --- a/tests/python/unittest/test_te_schedule_tensor_core.py
   +++ b/tests/python/unittest/test_te_schedule_tensor_core.py
   @@ -103,14 +103,16 @@ def intrin_wmma_store_matrix(shape):
        return te.decl_tensor_intrin(C.op, intrin_func, binds={A: BA, C: BC})
   
   
   -def test_tensor_core_batch_matmal():
   -    if not tvm.gpu(0).exist or not tvm.runtime.enabled("cuda"):
   -        print("skip because cuda is not enabled..")
   -        return
   -    if not nvcc.have_tensorcore(tvm.gpu(0).compute_version):
   -        print("skip because gpu does not support tensor core")
   -        return
   +__TRACE_COUNTER__ = 0
   +def dumpir(module, info, is_before):
   +    global __TRACE_COUNTER__
   +    if bool(is_before) == False:
   +        __TRACE_COUNTER__ += 1
   +        pname = str(__TRACE_COUNTER__).rjust(2,'0')  + "_" + info.name + ".ir"
   +        with open(pname, "a") as f:
   +            f.write(str(module))
   
   +def test_tensor_core_batch_matmal():
        batch_size = 4
        n = 512
        m, l = n, n
   @@ -195,7 +197,8 @@ def test_tensor_core_batch_matmal():
        s[C].tensorize(kernel_i, intrin_wmma_store_matrix((32, 8, 16)))
        s[CF].tensorize(_i, intrin_wmma_gemm((32, 8, 16)))
   
   -    func = tvm.build(s, [A, B, C], 'cuda')
   +    with tvm.transform.PassContext(opt_level=3, trace=dumpir):
   +        func = tvm.build(s, [A, B, C], 'cuda')
   
        ctx = tvm.gpu(0)
        a_np = np.random.uniform(size=(batch_size, nn, ll, 32, 16)).astype(A.dtype)
   @@ -384,4 +387,4 @@ def test_tensor_core_batch_conv():
   
    if __name__ == '__main__':
        test_tensor_core_batch_matmal()
   -    test_tensor_core_batch_conv()
   +    #test_tensor_core_batch_conv()
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] spectrometerHBH commented on issue #6413: TIR Printer bugs

Posted by GitBox <gi...@apache.org>.
spectrometerHBH commented on issue #6413:
URL: https://github.com/apache/incubator-tvm/issues/6413#issuecomment-688566205


   And #5965 #6147 are PRs related to the problems you encountered. You can try to sync your codebase and see if it works now.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] tqchen commented on issue #6413: TIR Printer bugs

Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #6413:
URL: https://github.com/apache/incubator-tvm/issues/6413#issuecomment-688463485


   cc @spectrometerHBH 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org