• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9#version 450 core
10
11#define PRECISION ${PRECISION}
12
13#define T ${buffer_scalar_type(DTYPE)}
14
15#include "indexing_utils.h"
16
17${define_required_extensions(DTYPE)}
18
19layout(std430) buffer;
20
21${layout_declare_buffer(0, "w", "out_buf", DTYPE, PRECISION, True)}
22${layout_declare_ubo(1, "int", "numel")}
23
24layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;
25
26void main() {
27  const int t_id = ivec3(gl_GlobalInvocationID).x;
28  if (t_id >= numel) {
29    return;
30  }
31
32  out_buf[t_id] = T(t_id);
33}
34