MCPcopy Create free account
hub / github.com/apache/tvm / test_for_with_break_continue

Function test_for_with_break_continue

tests/python/tirx/transform/test_stmt_functor.py:885–937  ·  view source on GitHub ↗

Test for loop with break and continue statements. Python ``break`` / ``continue`` keywords lower to ``T.evaluate(T.break_loop())`` / ``T.evaluate(T.continue_loop())`` (Evaluate + Call) rather than dedicated Break / Continue Stmt nodes.

()

Source from the content-addressed store, hash-verified

883
884
885def test_for_with_break_continue():
886 """Test for loop with break and continue statements.
887
888 Python ``break`` / ``continue`` keywords lower to
889 ``T.evaluate(T.break_loop())`` / ``T.evaluate(T.continue_loop())``
890 (Evaluate + Call) rather than dedicated Break / Continue Stmt nodes.
891 """
892 for_with_break = create_test_statements()["for_with_break"]
893 basic_check(
894 for_with_break,
895 "\n".join(
896 [
897 "For",
898 "\tIntImm",
899 "\tIntImm",
900 "\tSeqStmt",
901 "\t\tBufferStore",
902 "\t\t\tAdd",
903 "\t\t\t\tVar",
904 "\t\t\t\tIntImm",
905 "\t\t\tVar",
906 "\t\tIfThenElse",
907 "\t\t\tEQ",
908 "\t\t\t\tVar",
909 "\t\t\t\tIntImm",
910 "\t\t\tEvaluate",
911 "\t\t\t\tExpr::Call",
912 "\t\tEvaluate",
913 "\t\t\tExpr::Call",
914 ]
915 ),
916 "\n".join(
917 [
918 "IntImm",
919 "IntImm",
920 "Var",
921 "IntImm",
922 "Add",
923 "Var",
924 "BufferStore",
925 "Var",
926 "IntImm",
927 "EQ",
928 "Expr::Call",
929 "Evaluate",
930 "IfThenElse",
931 "Expr::Call",
932 "Evaluate",
933 "SeqStmt",
934 "For",
935 ]
936 ),
937 )
938
939
940def test_decl_buffer():

Callers

nothing calls this directly

Calls 3

create_test_statementsFunction · 0.70
basic_checkFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…