From aa3fa9f48e8b6bb059fed6d3be05159d94967c67 Mon Sep 17 00:00:00 2001 From: Dmitry Razdoburdin <> Date: Wed, 21 Feb 2024 23:23:00 -0800 Subject: [PATCH] remove dead comments --- plugin/sycl/tree/expand_entry.h | 38 +-------- plugin/sycl/tree/updater_quantile_hist.cc | 4 - .../cpp/plugin/test_sycl_partition_builder.cc | 81 ------------------- 3 files changed, 1 insertion(+), 122 deletions(-) diff --git a/plugin/sycl/tree/expand_entry.h b/plugin/sycl/tree/expand_entry.h index bc53c0a8bda4..577af73c2de1 100644 --- a/plugin/sycl/tree/expand_entry.h +++ b/plugin/sycl/tree/expand_entry.h @@ -14,44 +14,8 @@ namespace xgboost { namespace sycl { namespace tree { - using ExpandEntry = xgboost::tree::CPUExpandEntry; -/* tree growing policies */ -// struct ExpandEntry { -// static const int kRootNid = 0; -// static const int kEmptyNid = -1; -// int nid; -// int sibling_nid; -// int depth; -// bst_float loss_chg; -// unsigned timestamp; -// ExpandEntry(int nid, int sibling_nid, int depth, bst_float loss_chg, -// unsigned tstmp) -// : nid(nid), sibling_nid(sibling_nid), depth(depth), -// loss_chg(loss_chg), timestamp(tstmp) {} -// bool IsValid(xgboost::tree::TrainParam const ¶m, int32_t num_leaves) const { -// bool ret = loss_chg <= kRtEps || -// (param.max_depth > 0 && this->depth == param.max_depth) || -// (param.max_leaves > 0 && num_leaves == param.max_leaves); -// return ret; -// } -// }; - -// struct ExpandEntry : public xgboost::tree::ExpandEntryImpl { -// SplitEntry split; - -// ExpandEntry(bst_node_t nidx, bst_node_t depth, SplitEntry split) -// : nid(nid), depth(depth), split(std::move(split)) {} - -// bool IsValidImpl(xgboost::tree::TrainParam const ¶m, int32_t num_leaves) const { -// if (split.loss_chg <= kRtEps) return false; - -// bool ret = loss_chg <= kRtEps || -// (param.max_depth > 0 && this->depth == param.max_depth) || -// (param.max_leaves > 0 && num_leaves == param.max_leaves); -// return ret; -// } -// }; +using ExpandEntry = xgboost::tree::CPUExpandEntry; } // namespace tree } // namespace sycl diff --git a/plugin/sycl/tree/updater_quantile_hist.cc b/plugin/sycl/tree/updater_quantile_hist.cc index 8f57fad7b838..41a76d99f732 100644 --- a/plugin/sycl/tree/updater_quantile_hist.cc +++ b/plugin/sycl/tree/updater_quantile_hist.cc @@ -433,10 +433,6 @@ void QuantileHistMaker::Builder::AddSplitsToTree( int left_id = (*p_tree)[nid].LeftChild(); int right_id = (*p_tree)[nid].RightChild(); - // temp_qexpand_depth->push_back(ExpandEntry(left_id, right_id, - // p_tree->GetDepth(left_id), 0.0, (*timestamp)++)); - // temp_qexpand_depth->push_back(ExpandEntry(right_id, left_id, - // p_tree->GetDepth(right_id), 0.0, (*timestamp)++)); temp_qexpand_depth->push_back(ExpandEntry(left_id, p_tree->GetDepth(left_id))); temp_qexpand_depth->push_back(ExpandEntry(right_id, p_tree->GetDepth(right_id))); // - 1 parent + 2 new children diff --git a/tests/cpp/plugin/test_sycl_partition_builder.cc b/tests/cpp/plugin/test_sycl_partition_builder.cc index 607d68bff97d..c13c6209b82a 100644 --- a/tests/cpp/plugin/test_sycl_partition_builder.cc +++ b/tests/cpp/plugin/test_sycl_partition_builder.cc @@ -86,86 +86,5 @@ TEST(SyclPartitionBuilder, BasicTest) { ASSERT_EQ(n_left, rows_for_left_node[nid]); ASSERT_EQ(n_right, (rows[nid] - rows_for_left_node[nid])); } -} - - TEST(SyclPartitionBuilder, Partitioning) { - const size_t num_rows = 16; - const size_t num_columns = 2; - - Context ctx; - ctx.UpdateAllowUnknown(Args{{"device", "sycl"}}); - - DeviceManager device_manager; - auto qu = device_manager.GetQueue(ctx.Device()); - - auto p_fmat = RandomDataGenerator{num_rows, num_columns, 0.3}.GenerateDMatrix(); - sycl::DeviceMatrix dmat; - dmat.Init(qu, p_fmat.get()); - - int max_bins = 256; - common::GHistIndexMatrix gmat; - gmat.Init(qu, &ctx, dmat, max_bins); - - RowSetCollection row_set_collection; - auto& row_indices = row_set_collection.Data(); - row_indices.Resize(&qu, num_rows); - size_t* p_row_indices = row_indices.Data(); - - qu.submit([&](::sycl::handler& cgh) { - cgh.parallel_for<>(::sycl::range<1>(num_rows), - [p_row_indices](::sycl::item<1> pid) { - const size_t idx = pid.get_id(0); - p_row_indices[idx] = idx; - }); - }).wait_and_throw(); - row_set_collection.Init(); - - RegTree tree; - tree.ExpandNode(0, 0, 0, false, 0, 0, 0, 0, 0, 0, 0); - tree.ExpandNode(tree[0].LeftChild(), 0, 0, false, 0, 0, 0, 0, 0, 0, 0); - tree.ExpandNode(tree[0].RightChild(), 0, 0, false, 0, 0, 0, 0, 0, 0, 0); - - row_set_collection.AddSplit(0, tree[0].LeftChild(), tree[0].RightChild(), 9, 7); - row_set_collection.AddSplit(1, tree[1].LeftChild(), tree[1].RightChild(), 5, 4); - row_set_collection.AddSplit(2, tree[2].LeftChild(), tree[2].RightChild(), 4, 3); - - const size_t n_nodes = row_set_collection.Size(); - PartitionBuilder builder; - builder.Init(&qu, n_nodes, [&](size_t nid) { - return row_set_collection[nid].Size(); - }); - - // std::vector nodes; - // nodes.emplace_back(tree::ExpandEntry(0, tree::ExpandEntry::kEmptyNid, - // tree.GetDepth(tree::ExpandEntry::kRootNid), 0.0, 0)); - // nodes.emplace_back(tree::ExpandEntry(1, tree::ExpandEntry::kEmptyNid, - // tree.GetDepth(1), 0.0, 0)); - // nodes.emplace_back(tree::ExpandEntry(2, 1, - // tree.GetDepth(2), 0.0, 0)); - - // std::stringstream ss; - // ss << "Nodes: "; - // for (const auto& entry : nodes) { - // ss << "nid = " << entry.nid << "\n" - // << "sibling_nid = " << entry.sibling_nid << "\n" - // << "depth = " << entry.depth << "\n" - // << "loss_chg = " << entry.loss_chg << "\n" - // << "timestamp = " << entry.timestamp << "\n" - // << std::endl; - // } - // ASSERT_TRUE(false) << ss.str(); - - // ::sycl::event event; - // std::vector split_conditions = {-1, 1, 42}; - // builder.Partition(gmat, nodes, row_set_collection, - // split_conditions, &tree, &event); - // qu.wait_and_throw(); - - // for (size_t nid = 0; nid < n_nodes; nid++) { - // size_t* data_result = row_set_collection_[nid].begin; - // builder.MergeToArray(nid, data_result, &event); - // } - // qu.wait_and_throw(); - } } // namespace xgboost::sycl::common