Skip to content

Commit 3471f6f

Browse files
authored
Merge pull request #1367 from pytorch/partitioning_fix
chore: Fix centralized partititoning
2 parents 9399382 + 3017a39 commit 3471f6f

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ pkg_tar(
2222
"//core/lowering:include",
2323
"//core/lowering/passes:include",
2424
"//core/partitioning:include",
25+
"//core/partitioning/segmentedblock:include",
26+
"//core/partitioning/partitioninginfo:include",
27+
"//core/partitioning/partitioningctx:include",
2528
"//core/plugins:impl_include",
2629
"//core/plugins:include",
2730
"//core/runtime:include",

core/partitioning/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ add_library(${lib_name} OBJECT)
44
set(CXX_SRCS
55
"${CMAKE_CURRENT_SOURCE_DIR}/partitioning.cpp"
66
"${CMAKE_CURRENT_SOURCE_DIR}/shape_analysis.cpp"
7+
"${CMAKE_CURRENT_SOURCE_DIR}/stitching.cpp"
78
)
89

910
set(HEADER_FILES
@@ -36,4 +37,4 @@ add_subdirectory(partitioningctx)
3637
add_subdirectory(partitioninginfo)
3738
add_subdirectory(segmentedblock)
3839

39-
install(FILES ${HEADER_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/torch_tensorrt/core/partitioning")
40+
install(FILES ${HEADER_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/torch_tensorrt/core/partitioning")

core/partitioning/shape_analysis.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ std::unordered_map<const torch::jit::Value*, torch::jit::IValue> generateRandomI
3333

3434
for (auto& input : inputs) {
3535
if (input.first->type()->kind() == torch::jit::TypeKind::ListType) {
36-
// create list
37-
std::vector<torch::jit::IValue> list;
3836
c10::TypePtr elementType = c10::TensorType::get();
3937
auto generic_list = c10::impl::GenericList(elementType);
4038
for (size_t i = 0; i < input.second.size(); i++) {

py/setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ def run(self):
422422
"include/torch_tensorrt/core/lowering/*.h",
423423
"include/torch_tensorrt/core/lowering/passes/*.h",
424424
"include/torch_tensorrt/core/partitioning/*.h",
425+
"include/torch_tensorrt/core/partitioning/segmentedblock/*.h",
426+
"include/torch_tensorrt/core/partitioning/partitioninginfo/*.h",
427+
"include/torch_tensorrt/core/partitioning/partitioningctx/*.h",
425428
"include/torch_tensorrt/core/plugins/*.h",
426429
"include/torch_tensorrt/core/plugins/impl/*.h",
427430
"include/torch_tensorrt/core/runtime/*.h",

tests/core/conversion/converters/test_topk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TEST(Converters, ATenTopKConvertsCorrectly) {
2626
auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {in});
2727

2828
ASSERT_TRUE(
29-
torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 2e-6));
29+
torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]), 8e-5));
3030
ASSERT_TRUE(
31-
torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]), 2e-6));
31+
torch_tensorrt::tests::util::almostEqual(jit_results[1], trt_results[1].reshape_as(jit_results[1]), 8e-5));
3232
}

tests/util/util.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ bool cosineSimEqual(const at::Tensor& computed_tensor, const at::Tensor& gt_tens
1111
computed_tensor.flatten(), gt_tensor.flatten(), torch::nn::functional::CosineSimilarityFuncOptions().dim(0));
1212
std::ostringstream ss;
1313
ss << computed_tensor << std::endl << gt_tensor << std::endl;
14-
LOG_GRAPH(ss.str());
15-
LOG_GRAPH(std::string("Cosine Similarity score: ") + std::to_string(cosine_sim.item<float>()));
16-
LOG_GRAPH(std::string("Acceptable Threshold: ") + std::to_string(threshold));
14+
LOG_DEBUG(ss.str());
15+
LOG_DEBUG(std::string("Cosine Similarity score: ") + std::to_string(cosine_sim.item<float>()));
16+
LOG_DEBUG(std::string("Acceptable Threshold: ") + std::to_string(threshold));
1717

1818
return cosine_sim.item<float>() >= threshold;
1919
}
@@ -31,14 +31,14 @@ bool almostEqual(const at::Tensor& computed_tensor, const at::Tensor& gt_tensor,
3131
auto result = diff.abs().max().item<float>();
3232
auto threshold = atol + (rtol * gt_tensor.abs().max().item<float>());
3333

34-
LOG_GRAPH(std::string("Max Difference: ") + std::to_string(result));
35-
LOG_GRAPH(std::string("Acceptable Threshold: ") + std::to_string(threshold));
34+
LOG_DEBUG(std::string("Max Difference: ") + std::to_string(result));
35+
LOG_DEBUG(std::string("Acceptable Threshold: ") + std::to_string(threshold));
3636

3737
return result <= threshold;
3838
}
3939

4040
bool exactlyEqual(const at::Tensor& computed_tensor, const at::Tensor& gt_tensor) {
41-
LOG_GRAPH(computed_tensor << std::endl << gt_tensor << std::endl);
41+
LOG_DEBUG(computed_tensor << std::endl << gt_tensor << std::endl);
4242
std::cout << "Max Difference: " << (computed_tensor - gt_tensor).abs().max().item<float>() << std::endl;
4343

4444
return (computed_tensor - gt_tensor).abs().max().item<float>() == 0.f;

0 commit comments

Comments
 (0)