Skip to content

Commit

Permalink
replace sycl-specific implementation for multiclass obj
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Razdoburdin committed Nov 26, 2024
1 parent 7c22f22 commit 9c847ff
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 229 deletions.
6 changes: 0 additions & 6 deletions include/xgboost/objective.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ class ObjFunction : public Configurable {
* \param name Name of the objective.
*/
static ObjFunction* Create(const std::string& name, Context const* ctx);

/*!
* \brief Return sycl specific implementation name if possible.
* \param name Name of the objective.
*/
static std::string GetSyclImplementationName(const std::string& name);
};

/*!
Expand Down
3 changes: 2 additions & 1 deletion plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ if(PLUGIN_SYCL)
list(APPEND SYCL_SOURCES
${xgboost_SOURCE_DIR}/src/objective/regression_obj.cc
${xgboost_SOURCE_DIR}/src/objective/hinge.cc
${xgboost_SOURCE_DIR}/src/objective/quantile_obj.cc)
${xgboost_SOURCE_DIR}/src/objective/quantile_obj.cc
${xgboost_SOURCE_DIR}/src/objective/multiclass_obj.cc)
add_library(plugin_sycl OBJECT ${SYCL_SOURCES})
target_include_directories(plugin_sycl
PRIVATE
Expand Down
203 changes: 0 additions & 203 deletions plugin/sycl/objective/multiclass_obj.cc

This file was deleted.

1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if(PLUGIN_SYCL)
list(REMOVE_ITEM CPU_SOURCES ${xgboost_SOURCE_DIR}/src/objective/regression_obj.cc)
list(REMOVE_ITEM CPU_SOURCES ${xgboost_SOURCE_DIR}/src/objective/hinge.cc)
list(REMOVE_ITEM CPU_SOURCES ${xgboost_SOURCE_DIR}/src/objective/quantile_obj.cc)
list(REMOVE_ITEM CPU_SOURCES ${xgboost_SOURCE_DIR}/src/objective/multiclass_obj.cc)
endif()

#-- Object library
Expand Down
19 changes: 0 additions & 19 deletions src/objective/objective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ namespace xgboost {
// implement factory functions
ObjFunction* ObjFunction::Create(const std::string& name, Context const* ctx) {
std::string obj_name = name;
if (ctx->IsSycl()) {
obj_name = GetSyclImplementationName(obj_name);
}
auto *e = ::dmlc::Registry< ::xgboost::ObjFunctionReg>::Get()->Find(obj_name);
if (e == nullptr) {
std::stringstream ss;
Expand All @@ -36,22 +33,6 @@ ObjFunction* ObjFunction::Create(const std::string& name, Context const* ctx) {
return pobj;
}

/* If the objective function has sycl-specific implementation,
* returns the specific implementation name.
* Otherwise return the orginal name without modifications.
*/
std::string ObjFunction::GetSyclImplementationName(const std::string& name) {
const std::string sycl_postfix = "_sycl";
auto *e = ::dmlc::Registry< ::xgboost::ObjFunctionReg>::Get()->Find(name + sycl_postfix);
if (e != nullptr) {
// Function has specific sycl implementation
return name + sycl_postfix;
} else {
// Function hasn't specific sycl implementation
return name;
}
}

void ObjFunction::InitEstimation(MetaInfo const&, linalg::Tensor<float, 1>* base_score) const {
CHECK(base_score);
base_score->Reshape(1);
Expand Down

0 comments on commit 9c847ff

Please sign in to comment.