code: def test_end_to_end():
      mgr = kp.Manager()
  
      tensor_in_a = mgr.tensor([2, 2, 2])
      tensor_in_b = mgr.tensor([1, 2, 3])
      # Explicit type constructor supports int, in32, double, float and int
      tensor_out_a = mgr.tensor_t(np.array([0, 0, 0], dtype=np.uint32))
      tensor_out_b = mgr.tensor_t(np.array([0, 0, 0], dtype=np.uint32))
  
      params = [tensor_in_a, tensor_in_b, tensor_out_a, tensor_out_b]
  
      shader = """
          #version 450
  
          layout (local_size_x = 1) in;
  
          // The input tensors bind index is relative to index in parameter passed
          layout(set = 0, binding = 0) buffer buf_in_a { float in_a[]; };
          layout(set = 0, binding = 1) buffer buf_in_b { float in_b[]; };
          layout(set = 0, binding = 2) buffer buf_out_a { uint out_a[]; };
          layout(set = 0, binding = 3) buffer buf_out_b { uint out_b[]; };
  
          // Kompute supports push constants updated on dispatch
          layout(push_constant) uniform PushConstants {
              float val;
          } push_const;
  
          // Kompute also supports spec constants on initalization
          layout(constant_id = 0) const float const_one = 0;
  
          void main() {
              uint index = gl_GlobalInvocationID.x;
              out_a[index] += uint( in_a[index] * in_b[index] );
              out_b[index] += uint( const_one * push_const.val );
          }
      """
  
      workgroup = (3, 1, 1)
      spec_consts = [2]
      push_consts_a = [2]
      push_consts_b = [3]
  
      algo = mgr.algorithm(
          params,
          compile_source(shader),
          workgroup,
          spec_consts,
          push_consts_a,
      )
  
      (
          mgr.sequence()
          .record(kp.OpTensorSyncDevice(params))
          .record(kp.OpAlgoDispatch(algo))
          .record(kp.OpAlgoDispatch(algo, push_consts_b))
          .eval()
      )
  
      sq = mgr.sequence()
      sq.eval_async(kp.OpTensorSyncLocal(params))
  
      sq.eval_await()
  
      assert tensor_out_a.data().tolist() == [4, 8, 12]
      assert tensor_out_b.data().tolist() == [10, 10, 10]
  
file_path: kompute/python/test/test_kompute.py
imports: import os
  import kp
  import numpy
  import logging
  import pyshader
  from .utils import compile_source
label_desc: Use image node_id 1 for calling a global function with example usage: test_end_to_end() without return types