Skip to content

Commit b37cd75

Browse files
authored
MAINT: Revert most of the legate 25.05 changes (#229)
Legate was update to allow the old patterns which means we can revert the changes done to support 25.05 (with the exception of actually bumping it and moving `TASK_CONFIG` to the global Task template). Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>
1 parent 04aae59 commit b37cd75

20 files changed

Lines changed: 41 additions & 161 deletions

src/cpp_utils/cpp_utils.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ class ThrustAllocator : public legate::ScopedAllocator {
162162
void deallocate(char* ptr, size_t /*n*/) { ScopedAllocator::deallocate(ptr); }
163163
};
164164

165-
template <typename F>
166-
void UnaryOp<F>::gpu_variant(legate::TaskContext context)
165+
template <typename F, int OpCode>
166+
void UnaryOpTask<F, OpCode>::gpu_variant(legate::TaskContext context)
167167
{
168168
auto const& in = context.input(0);
169169
auto* stream = context.get_task_stream();

src/cpp_utils/cpp_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ void extract_scalars(std::tuple<Tp...>& t, legate::TaskContext context)
308308
}
309309
inline void extract_scalars(std::tuple<>& t, legate::TaskContext context) {}
310310

311-
template <typename F>
312-
class UnaryOp {
311+
template <typename F, int OpCode>
312+
class UnaryOpTask : public Task<UnaryOpTask<F, OpCode>, OpCode> {
313313
public:
314314
template <std::int32_t kDim, typename Policy>
315315
struct DispatchTypeOp {

src/encoder/target_encoder.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,12 @@ struct target_encoder_encode_fn {
219219
type_dispatch_float(X.code(), target_encoder_encode_fn(), context);
220220
}
221221
} // namespace legateboost
222-
223222
namespace // unnamed
224223
{
225-
226-
const auto reg_id_ = []() -> char {
224+
void __attribute__((constructor)) register_tasks()
225+
{
227226
legateboost::TargetEncoderMeanTask::register_variants();
228227
legateboost::TargetEncoderEncodeTask::register_variants();
229228
legateboost::TargetEncoderVarianceTask::register_variants();
230-
return 0;
231-
}();
232-
229+
}
233230
} // namespace

src/encoder/target_encoder.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ 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}};
2725

2826
static void cpu_variant(legate::TaskContext context);
2927
#ifdef LEGATEBOOST_USE_CUDA
@@ -35,8 +33,6 @@ class TargetEncoderVarianceTask : public Task<TargetEncoderVarianceTask, TARGET_
3533
public:
3634
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
3735
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}};
4036

4137
static void cpu_variant(legate::TaskContext context);
4238
#ifdef LEGATEBOOST_USE_CUDA
@@ -48,8 +44,6 @@ class TargetEncoderEncodeTask : public Task<TargetEncoderEncodeTask, TARGET_ENCO
4844
public:
4945
static constexpr auto CPU_VARIANT_OPTIONS = legate::VariantOptions{}.with_has_allocations(false);
5046
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}};
5347

5448
static void cpu_variant(legate::TaskContext context);
5549
#ifdef LEGATEBOOST_USE_CUDA

src/legate_library.h

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

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

src/models/krr/rbf.cc

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@
1515
*
1616
*/
1717
#include "models/krr/rbf.h"
18-
namespace legateboost {
19-
/*static*/ void RbfTask::cpu_variant(legate::TaskContext context)
18+
namespace // unnamed
2019
{
21-
legateboost::UnaryOp<RbfOp>::cpu_variant(context);
22-
}
23-
} // namespace legateboost
24-
25-
namespace {
26-
const auto reg_id_ = []() -> char {
27-
legateboost::RbfTask::register_variants();
28-
return 0;
29-
}();
20+
void __attribute__((constructor)) register_tasks() { legateboost::RbfTask::register_variants(); }
3021
} // namespace

src/models/krr/rbf.cu

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "../../cpp_utils/cpp_utils.cuh"
1919

2020
namespace legateboost {
21-
/*static*/ void RbfTask::gpu_variant(legate::TaskContext context)
22-
{
23-
UnaryOp<RbfOp>::gpu_variant(context);
24-
}
21+
// Explicit instantiation
22+
template void RbfTask::gpu_variant(legate::TaskContext context);
2523
}; // namespace legateboost

src/models/krr/rbf.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,5 @@ struct RbfOp {
3131
}
3232
};
3333

34-
class RbfTask : public Task<RbfTask, RBF> {
35-
public:
36-
static inline const auto TASK_CONFIG = legate::TaskConfig{legate::LocalTaskID{RBF}};
37-
static void cpu_variant(legate::TaskContext context);
38-
#ifdef LEGATEBOOST_USE_CUDA
39-
static void gpu_variant(legate::TaskContext context);
40-
#endif
41-
};
34+
using RbfTask = UnaryOpTask<RbfOp, RBF>;
4235
} // namespace legateboost

src/models/nn/build_nn.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ struct build_nn_fn {
570570
} // namespace legateboost
571571
namespace // unnamed
572572
{
573-
const auto reg_id_ = []() -> char {
573+
void __attribute__((constructor)) register_tasks()
574+
{
574575
legateboost::BuildNNTask::register_variants();
575-
return 0;
576-
}();
576+
}
577577
} // namespace

src/models/nn/build_nn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ 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}};
171170

172171
static void cpu_variant(legate::TaskContext context);
173172
#ifdef LEGATEBOOST_USE_CUDA

0 commit comments

Comments
 (0)