<commit_before>/*******************************************************
 * Copyright (c) 2014, ArrayFire
 * All rights reserved.
 *
 * This file is distributed under 3-clause BSD license.
 * The complete license agreement can be obtained at:
 * http://arrayfire.com/licenses/BSD-3-Clause
 ********************************************************/

typedef struct {
    dim_type dim[4];
} dims_t;

__kernel
void memcopy_kernel(__global T *out, dims_t ostrides,
                    __global const T *in, dims_t idims,
                    dims_t istrides, dim_type offset,
                    dim_type groups_0, dim_type groups_1)
{
    const dim_type lid0 = get_local_id(0);
    const dim_type lid1 = get_local_id(1);

    const dim_type id2 = get_group_id(0) / groups_0;
    const dim_type id3 = get_group_id(1) / groups_1;
    const dim_type group_id_0 = get_group_id(0) - groups_0 * id2;
    const dim_type group_id_1 = get_group_id(1) - groups_1 * id3;
    const dim_type id0 = group_id_0 * get_num_groups(0) + lid0;
    const dim_type id1 = group_id_1 * get_num_groups(1) + lid1;

    in += offset;

    // FIXME: Do more work per work group
    out += id3 * ostrides.dim[3] + id2 * ostrides.dim[2] + id1 * ostrides.dim[1];
    in  += id3 * istrides.dim[3] + id2 * istrides.dim[2] + id1 * istrides.dim[1];

    dim_type istride0 = istrides.dim[0];
    if (id0 < idims.dim[0] &&
        id1 < idims.dim[1] &&
        id2 < idims.dim[2] &&
        id3 < idims.dim[3]) {
        out[id0] = in[id0 * istride0];
    }
}<commit_msg>BUGFIX: memcopy kernel was creating indices incorrectly<commit_after>/*******************************************************
 * Copyright (c) 2014, ArrayFire
 * All rights reserved.
 *
 * This file is distributed under 3-clause BSD license.
 * The complete license agreement can be obtained at:
 * http://arrayfire.com/licenses/BSD-3-Clause
 ********************************************************/

typedef struct {
    dim_type dim[4];
} dims_t;

__kernel
void memcopy_kernel(__global T *out, dims_t ostrides,
                    __global const T *in, dims_t idims,
                    dims_t istrides, dim_type offset,
                    dim_type groups_0, dim_type groups_1)
{
    const dim_type lid0 = get_local_id(0);
    const dim_type lid1 = get_local_id(1);

    const dim_type id2 = get_group_id(0) / groups_0;
    const dim_type id3 = get_group_id(1) / groups_1;
    const dim_type group_id_0 = get_group_id(0) - groups_0 * id2;
    const dim_type group_id_1 = get_group_id(1) - groups_1 * id3;
    const dim_type id0 = group_id_0 * get_local_size(0) + lid0;
    const dim_type id1 = group_id_1 * get_local_size(1) + lid1;

    in += offset;

    // FIXME: Do more work per work group
    out += id3 * ostrides.dim[3] + id2 * ostrides.dim[2] + id1 * ostrides.dim[1];
    in  += id3 * istrides.dim[3] + id2 * istrides.dim[2] + id1 * istrides.dim[1];

    dim_type istride0 = istrides.dim[0];
    if (id0 < idims.dim[0] &&
        id1 < idims.dim[1] &&
        id2 < idims.dim[2] &&
        id3 < idims.dim[3]) {
        out[id0] = in[id0 * istride0];
    }
}
{'fraction_non_alphanumeric': 0.17838709677419354, 'fraction_numerical': 0.03870967741935484, 'mean_word_length': 3.0012903225806453, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '6798479', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1111, 'n_words': 268}