Skip to content

Commit 114a05f

Browse files
committed
Move task-config out of global template and adjust init func as per review
Signed-off-by: Sebastian Berg <[email protected]>
1 parent 3eb7bbb commit 114a05f

16 files changed

+38
-17
lines changed

src/cpp_utils/cpp_utils.h

+2
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ inline void extract_scalars(std::tuple<>& t, legate::TaskContext context) {}
311311
template <typename F, int OpCode>
312312
class UnaryOpTask : public Task<UnaryOpTask<F, OpCode>, OpCode> {
313313
public:
314+
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{OpCode}};
315+
314316
template <std::int32_t kDim, typename Policy>
315317
struct DispatchTypeOp {
316318
template <typename T>

src/encoder/target_encoder.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ struct target_encoder_encode_fn {
223223
namespace // unnamed
224224
{
225225

226-
const auto reg_tasks_ = []() -> char {
226+
static const auto reg_id_ = []() -> char {
227227
legateboost::TargetEncoderMeanTask::register_variants();
228228
legateboost::TargetEncoderEncodeTask::register_variants();
229229
legateboost::TargetEncoderVarianceTask::register_variants();

src/encoder/target_encoder.h

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class TargetEncoderMeanTask : public Task<TargetEncoderMeanTask, TARGET_ENCODER_
2222
public:
2323
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
2424
static constexpr auto GPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
25+
static inline const auto TASK_CONFIG =
26+
legate::TaskConfig{legate::LocalTaskID{TARGET_ENCODER_MEAN}};
2527

2628
static void cpu_variant(legate::TaskContext context);
2729
#ifdef LEGATEBOOST_USE_CUDA
@@ -33,6 +35,8 @@ class TargetEncoderVarianceTask : public Task<TargetEncoderVarianceTask, TARGET_
3335
public:
3436
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
3537
static constexpr auto GPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
38+
static inline const auto TASK_CONFIG =
39+
legate::TaskConfig{legate::LocalTaskID{TARGET_ENCODER_VARIANCE}};
3640

3741
static void cpu_variant(legate::TaskContext context);
3842
#ifdef LEGATEBOOST_USE_CUDA
@@ -44,6 +48,8 @@ class TargetEncoderEncodeTask : public Task<TargetEncoderEncodeTask, TARGET_ENCO
4448
public:
4549
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
4650
static constexpr auto GPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
51+
static inline const auto TASK_CONFIG =
52+
legate::TaskConfig{legate::LocalTaskID{TARGET_ENCODER_ENCODE}};
4753

4854
static void cpu_variant(legate::TaskContext context);
4955
#ifdef LEGATEBOOST_USE_CUDA

src/legate_library.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ struct Task : public legate::LegateTask<T> {
2626
Task() = default;
2727

2828
public:
29-
using Registrar = Registry;
30-
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{ID}};
29+
using Registrar = Registry;
3130
friend T;
3231
};
3332

src/models/krr/rbf.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#include "models/krr/rbf.h"
1818
namespace // unnamed
1919
{
20-
const auto reg_tasks_ = []() -> char {
21-
legateboost::RbfTask::register_variants();
20+
struct RbfTask : legateboost::RbfTask {};
21+
22+
static const auto reg_id_ = []() -> char {
23+
RbfTask::register_variants();
2224
return 0;
2325
}();
2426
} // namespace

src/models/nn/build_nn.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ struct build_nn_fn {
570570
} // namespace legateboost
571571
namespace // unnamed
572572
{
573-
const auto reg_tasks_ = []() -> char {
573+
static const auto reg_id_ = []() -> char {
574574
legateboost::BuildNNTask::register_variants();
575575
return 0;
576576
}();

src/models/nn/build_nn.h

+1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class BuildNNTask : public Task<BuildNNTask, BUILD_NN> {
167167
public:
168168
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(true);
169169
static constexpr auto GPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(true);
170+
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{BUILD_NN}};
170171

171172
static void cpu_variant(legate::TaskContext context);
172173
#ifdef LEGATEBOOST_USE_CUDA

src/models/tree/build_tree.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ struct build_tree_fn {
542542

543543
namespace // unnamed
544544
{
545-
const auto reg_tasks_ = []() -> char {
545+
static const auto reg_id_ = []() -> char {
546546
legateboost::BuildTreeTask::register_variants();
547547
return 0;
548548
}();

src/models/tree/build_tree.h

+1
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ class BuildTreeTask : public Task<BuildTreeTask, BUILD_TREE> {
289289
public:
290290
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(true);
291291
static constexpr auto GPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(true);
292+
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{BUILD_TREE}};
292293

293294
static void cpu_variant(legate::TaskContext context);
294295
#ifdef LEGATEBOOST_USE_CUDA

src/models/tree/predict.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct predict_fn {
7777

7878
namespace // unnamed
7979
{
80-
const auto reg_tasks_ = []() -> char {
80+
static const auto reg_id_ = []() -> char {
8181
legateboost::PredictTask::register_variants();
8282
return 0;
8383
}();

src/models/tree/predict.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace legateboost {
2222

2323
class PredictTask : public Task<PredictTask, PREDICT> {
2424
public:
25+
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{PREDICT}};
26+
2527
static void cpu_variant(legate::TaskContext context);
2628
#ifdef LEGATEBOOST_USE_CUDA
2729
static void gpu_variant(legate::TaskContext context);

src/models/tree/update_tree.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ struct update_tree_fn {
122122
class UpdateTreeTask : public Task<UpdateTreeTask, UPDATE_TREE> {
123123
public:
124124
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(true);
125+
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{UPDATE_TREE}};
125126

126127
static void cpu_variant(legate::TaskContext context)
127128
{
@@ -134,7 +135,7 @@ class UpdateTreeTask : public Task<UpdateTreeTask, UPDATE_TREE> {
134135

135136
namespace // unnamed
136137
{
137-
const auto reg_tasks_ = []() -> char {
138+
static const auto reg_id_ = []() -> char {
138139
legateboost::UpdateTreeTask::register_variants();
139140
return 0;
140141
}();

src/special/special.cc

+12-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@
1616
#include "../cpp_utils/cpp_utils.h"
1717
namespace // unnamed
1818
{
19-
const auto reg_tasks_ = []() -> char {
20-
legateboost::ErfTask::register_variants();
21-
legateboost::LgammaTask::register_variants();
22-
legateboost::TgammaTask::register_variants();
23-
legateboost::DigammaTask::register_variants();
24-
legateboost::ZetaTask::register_variants();
19+
struct ErfTask : legateboost::ErfTask {};
20+
struct LgammaTask : legateboost::LgammaTask {};
21+
struct TgammaTask : legateboost::TgammaTask {};
22+
struct DigammaTask : legateboost::DigammaTask {};
23+
struct ZetaTask : legateboost::ZetaTask {};
24+
25+
static const auto reg_id_ = []() -> char {
26+
ErfTask::register_variants();
27+
LgammaTask::register_variants();
28+
TgammaTask::register_variants();
29+
DigammaTask::register_variants();
30+
ZetaTask::register_variants();
2531
return 0;
2632
}();
2733
} // namespace

src/special/special.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ struct ZetaOp {
315315
};
316316

317317
using ErfTask = UnaryOpTask<ErfOp, ERF>;
318-
using TgammaTask = UnaryOpTask<TgammaOp, TGAMMA>;
319318
using LgammaTask = UnaryOpTask<LgammaOp, LGAMMA>;
319+
using TgammaTask = UnaryOpTask<TgammaOp, TGAMMA>;
320320
using DigammaTask = UnaryOpTask<DigammaOp, DIGAMMA>;
321321
using ZetaTask = UnaryOpTask<ZetaOp, ZETA>;
322322

src/utils/gather.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct gather_fn {
7575

7676
namespace // unnamed
7777
{
78-
const auto reg_tasks_ = []() -> char {
78+
static const auto reg_id_ = []() -> char {
7979
legateboost::GatherTask::register_variants();
8080
return 0;
8181
}();

src/utils/gather.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class GatherTask : public Task<GatherTask, GATHER> {
2323
public:
2424
// GPU variant may create buffer to copy from host
2525
static constexpr auto GPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(true);
26+
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{GATHER}};
2627

2728
static void cpu_variant(legate::TaskContext context);
2829
#ifdef LEGATEBOOST_USE_CUDA

0 commit comments

Comments
 (0)