junrushao1994 commented on code in PR #11793: URL: https://github.com/apache/tvm/pull/11793#discussion_r912576001
########## tests/python/unittest/test_tir_transform_local_pad.py: ########## @@ -0,0 +1,168 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# pylint: disable=missing-module-docstring +import numpy as np +from tvm.script import tir as T +import tvm.testing +from tvm.tir import Schedule + + +def sample_dense_sched(sch): # pylint: disable=too-many-statements Review Comment: Two comments on this unittest: First, in latest TVM infrastructure, we do not need to do end-to-end testing (i.e. generating cuda kernels, do some approximate equality check, etc) in unittests. Instead, we write TVMScript from bare hand. Some examples in testing split/fuse in TIR schedule: https://github.com/apache/tvm/blob/main/tests/python/unittest/test_tir_schedule_split_fuse.py Therefore, to test a single specific pass or two passes (local-pad and vectorize-loop), it's preferred to write two TVMScripts to represent the input of this pass and the corresponding expected outcome, then invoke the specific pass, and finally do structural equality assertion to check correctness. This way, you will get rid of using anything from TIR Schedule or end-to-end `tvm.build` pipeline, but instead focus on one specific pass as the definition of being "unit" in unittests. Second comment is about TVMScript. It actually supports limited metaprogrmming right now. For exameple -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
