Sha256: 9086c6cbf50bd5cb99b14aa1b5bdfde92ea85dea0e246ec24ad59ee428484dfd

Contents?: true

Size: 819 Bytes

Versions: 13

Compression:

Stored size: 819 Bytes

Contents

% ctype = dtype_to_c_type(data_type)

__kernel void concat(const int N, const int index, const int step, __global const <%= ctype %> *A, __global <%= ctype %> *C) {
    // Get the index of the current element to be processed
    const int globalCol = get_global_id(0); // Col ID of C (0..N)
    int ptr = globalCol;

    // compute effective coordinates
<% divisors.each_with_index do |div, index| %>
    <% if axis == index %>
        int index_map_<%= index %> = (int)floor(ptr / (float)<%= div %>) + step;
    <% else %>
        int index_map_<%= index %> = (int)floor(ptr / (float)<%= div %>);
    <% end %>
    <% if index < divisors.size - 1%>
        ptr = ptr % <%= div %>;
    <% end %>
<% end %>

    C[<%= multipliers.each_with_index.map { |m, idx| "#{m}*index_map_#{idx}" }.join(' + ') %>] = A[globalCol];
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tensor_stream-opencl-0.3.2 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.3.1 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.3.0 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.10 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.9 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.8 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.6 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.5 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.4 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.3 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.2 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.1 lib/tensor_stream/opencl/kernels/concat.cl
tensor_stream-opencl-0.2.0 lib/tensor_stream/opencl/kernels/concat.cl