Skip to content

Commit

Permalink
remove dead comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Razdoburdin committed Feb 22, 2024
1 parent 8c11d12 commit aa3fa9f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 122 deletions.
38 changes: 1 addition & 37 deletions plugin/sycl/tree/expand_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 &param, 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<CPUExpandEntry> {
// 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 &param, 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
Expand Down
4 changes: 0 additions & 4 deletions plugin/sycl/tree/updater_quantile_hist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,6 @@ void QuantileHistMaker::Builder<GradientSumT>::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
Expand Down
81 changes: 0 additions & 81 deletions tests/cpp/plugin/test_sycl_partition_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<tree::ExpandEntry> 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<int32_t> 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

0 comments on commit aa3fa9f

Please sign in to comment.