sglang_v0.5.2/pytorch_2.8.0/test/cpp/jit
hailin c8e8c1e9ff . 2025-09-20 16:09:34 +08:00
..
upgrader_models . 2025-09-20 16:09:34 +08:00
CMakeLists.txt . 2025-09-20 16:09:34 +08:00
README.md . 2025-09-20 16:09:34 +08:00
__init__.py . 2025-09-20 16:09:34 +08:00
script_module_v4.ptl . 2025-09-20 16:09:34 +08:00
script_module_v5.ptl . 2025-09-20 16:09:34 +08:00
script_module_v6.ptl . 2025-09-20 16:09:34 +08:00
source_range_test.cpp . 2025-09-20 16:09:34 +08:00
test_add_if_then_else.cpp . 2025-09-20 16:09:34 +08:00
test_alias_analysis.cpp . 2025-09-20 16:09:34 +08:00
test_argument_spec.cpp . 2025-09-20 16:09:34 +08:00
test_autodiff.cpp . 2025-09-20 16:09:34 +08:00
test_backend.cpp . 2025-09-20 16:09:34 +08:00
test_backend_compiler_lib.cpp . 2025-09-20 16:09:34 +08:00
test_backend_compiler_preprocess.cpp . 2025-09-20 16:09:34 +08:00
test_backend_lib.cpp . 2025-09-20 16:09:34 +08:00
test_class_import.cpp . 2025-09-20 16:09:34 +08:00
test_class_parser.cpp . 2025-09-20 16:09:34 +08:00
test_class_type.cpp . 2025-09-20 16:09:34 +08:00
test_cleanup_passes.cpp . 2025-09-20 16:09:34 +08:00
test_code_template.cpp . 2025-09-20 16:09:34 +08:00
test_concat_opt.cpp . 2025-09-20 16:09:34 +08:00
test_constant_pooling.cpp . 2025-09-20 16:09:34 +08:00
test_create_autodiff_subgraphs.cpp . 2025-09-20 16:09:34 +08:00
test_cs_debug_info_serialization.cpp . 2025-09-20 16:09:34 +08:00
test_custom_class.cpp . 2025-09-20 16:09:34 +08:00
test_custom_class_registrations.cpp . 2025-09-20 16:09:34 +08:00
test_custom_class_registrations.h . 2025-09-20 16:09:34 +08:00
test_custom_operators.cpp . 2025-09-20 16:09:34 +08:00
test_dce.cpp . 2025-09-20 16:09:34 +08:00
test_exception.cpp . 2025-09-20 16:09:34 +08:00
test_file_format.cpp . 2025-09-20 16:09:34 +08:00
test_flatbuffer.cpp . 2025-09-20 16:09:34 +08:00
test_fuser.cpp . 2025-09-20 16:09:34 +08:00
test_graph_executor.cpp . 2025-09-20 16:09:34 +08:00
test_graph_iterator.cpp . 2025-09-20 16:09:34 +08:00
test_inliner.cpp . 2025-09-20 16:09:34 +08:00
test_interface.cpp . 2025-09-20 16:09:34 +08:00
test_interpreter.cpp . 2025-09-20 16:09:34 +08:00
test_interpreter_async.pt . 2025-09-20 16:09:34 +08:00
test_ir.cpp . 2025-09-20 16:09:34 +08:00
test_irparser.cpp . 2025-09-20 16:09:34 +08:00
test_jit_logging_levels.cpp . 2025-09-20 16:09:34 +08:00
test_jit_type.cpp . 2025-09-20 16:09:34 +08:00
test_lexer.cpp . 2025-09-20 16:09:34 +08:00
test_lite_interpreter.cpp . 2025-09-20 16:09:34 +08:00
test_lite_interpreter_direct.cpp . 2025-09-20 16:09:34 +08:00
test_lite_trainer.cpp . 2025-09-20 16:09:34 +08:00
test_load_upgraders.cpp . 2025-09-20 16:09:34 +08:00
test_memory_dag.cpp . 2025-09-20 16:09:34 +08:00
test_misc.cpp . 2025-09-20 16:09:34 +08:00
test_mobile_type_parser.cpp . 2025-09-20 16:09:34 +08:00
test_module_api.cpp . 2025-09-20 16:09:34 +08:00
test_op_replacement.cpp . 2025-09-20 16:09:34 +08:00
test_peephole_optimize.cpp . 2025-09-20 16:09:34 +08:00
test_qualified_name.cpp . 2025-09-20 16:09:34 +08:00
test_save_load.cpp . 2025-09-20 16:09:34 +08:00
test_schema_info.cpp . 2025-09-20 16:09:34 +08:00
test_schema_matching.cpp . 2025-09-20 16:09:34 +08:00
test_script_profile.cpp . 2025-09-20 16:09:34 +08:00
test_shape_analysis.cpp . 2025-09-20 16:09:34 +08:00
test_stack_opt.cpp . 2025-09-20 16:09:34 +08:00
test_subgraph_matcher.cpp . 2025-09-20 16:09:34 +08:00
test_subgraph_rewriter.cpp . 2025-09-20 16:09:34 +08:00
test_subgraph_utils.cpp . 2025-09-20 16:09:34 +08:00
test_union.cpp . 2025-09-20 16:09:34 +08:00
test_upgrader_utils.cpp . 2025-09-20 16:09:34 +08:00
test_utils.cpp . 2025-09-20 16:09:34 +08:00
test_utils.h . 2025-09-20 16:09:34 +08:00
tests_setup.py . 2025-09-20 16:09:34 +08:00
torch_python_test.cpp . 2025-09-20 16:09:34 +08:00

README.md

JIT C++ Tests

Adding a new test

First, create a new test file. Test files should have be placed in this directory, with a name that starts with test_, like test_foo.cpp.

In general a single test suite

Add your test file to the JIT_TEST_SRCS list in test/cpp/jit/CMakeLists.txt.

A test file may look like:

#include <gtest/gtest.h>

using namespace ::torch::jit

TEST(FooTest, BarBaz) {
   // ...
}

// Append '_CUDA' to the test case name will automatically filter it out if CUDA
// is not compiled.
TEST(FooTest, NeedsAGpu_CUDA) {
   // ...
}

// Similarly, if only one GPU is detected, tests with `_MultiCUDA` at the end
// will not be run.
TEST(FooTest, NeedsMultipleGpus_MultiCUDA) {
   // ...
}

Building and running the tests

The following commands assume you are in PyTorch root.

# ... Build PyTorch from source, e.g.
python setup.py develop
# (re)build just the binary
ninja -C build bin/test_jit
# run tests
build/bin/test_jit --gtest_filter='glob_style_filter*'