<commit_before>#pragma once

#include <algorithm>
#include <cstdint>
#include <type_traits>

#include "xchainer/cuda/cuda_runtime.h"
#include "xchainer/macro.h"
#include "xchainer/reduction_kernel_arg.h"

namespace xchainer {
namespace cuda {
namespace reduce_detail {

static constexpr int kMaxReductionBlockSize = 512;
static constexpr int64_t kMaxGridSize = int64_t{0x7fffffffUL};

int64_t RoundUpToPowerOf2(int64_t x) {
    --x;
    x |= x >> 1;
    x |= x >> 2;
    x |= x >> 4;
    x |= x >> 8;
    x |= x >> 16;
    x |= x >> 32;
    return x + 1;
}

#define _REDUCE(offset)                               \
    if (tid < offset) {                               \
        impl.Reduce(work[(tid + offset)], work[tid]); \
    }

template <
        typename In,<commit_msg>Remove redundant int64_t<commit_after>#pragma once

#include <algorithm>
#include <cstdint>
#include <type_traits>

#include "xchainer/cuda/cuda_runtime.h"
#include "xchainer/macro.h"
#include "xchainer/reduction_kernel_arg.h"

namespace xchainer {
namespace cuda {
namespace reduce_detail {

static constexpr int kMaxReductionBlockSize{512};
static constexpr int64_t kMaxGridSize{0x7fffffff};

int64_t RoundUpToPowerOf2(int64_t x) {
    --x;
    x |= x >> 1;
    x |= x >> 2;
    x |= x >> 4;
    x |= x >> 8;
    x |= x >> 16;
    x |= x >> 32;
    return x + 1;
}

#define _REDUCE(offset)                               \
    if (tid < offset) {                               \
        impl.Reduce(work[(tid + offset)], work[tid]); \
    }

template <
        typename In,
{'fraction_non_alphanumeric': 0.13161290322580646, 'fraction_numerical': 0.02967741935483871, 'mean_word_length': 2.3938730853391683, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7287049', 'n_tokens_mistral': 597, 'n_tokens_neox': 549, 'n_words': 131}