Module tornado.api

Interface ExecutionContext

All Known Implementing Classes:
KernelContext

public interface ExecutionContext
Generic interface for TornadoVM to implement a Thread-Context API. This interface allows the client to implement barriers, allocate memory in local memory (OpenCL) or in shared memory (NVIDIA PTX).
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Array Allocation in Local Memory (OpenCL terminology).
    double[]
    Array Allocation in Local Memory (OpenCL terminology).
    float[]
    Array Allocation in Local Memory (OpenCL terminology).
    Array Allocation in Local Memory (OpenCL terminology).
    int[]
    Array Allocation in Local Memory (OpenCL terminology).
    long[]
    Array Allocation in Local Memory (OpenCL terminology).
    void
    atomicAdd(int[] array, int index, int val)
    Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.
    void
    atomicAdd(DoubleArray array, int index, double val)
    Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.
    void
    atomicAdd(FloatArray array, int index, float val)
    Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.
    void
    atomicAdd(IntArray array, int index, int val)
    Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.
    void
    atomicAdd(LongArray array, int index, long val)
    Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.
    void
    It adds a barrier for sync all threads within the same work-group to ensure correct order in global memory (OpenCL terminology).
    void
    It adds a barrier for sync all threads within the same work-group to ensure correct order in local memory (OpenCL terminology).
  • Method Details

    • localBarrier

      void localBarrier()
      It adds a barrier for sync all threads within the same work-group to ensure correct order in local memory (OpenCL terminology).

      Similar the OpenCL construct:

      barrier(CLK_LOCAL_MEM_FENCE);
    • globalBarrier

      void globalBarrier()
      It adds a barrier for sync all threads within the same work-group to ensure correct order in global memory (OpenCL terminology).

      Similar the OpenCL construct:

      barrier(CLK_GLOBAL_MEM_FENCE);
    • allocateIntLocalArray

      int[] allocateIntLocalArray(int size)
      Array Allocation in Local Memory (OpenCL terminology).
      Parameters:
      size - size of the int-array.
      Returns:
      int[]
    • allocateLongLocalArray

      long[] allocateLongLocalArray(int size)
      Array Allocation in Local Memory (OpenCL terminology).
      Parameters:
      size - size of the long-array.
      Returns:
      long[]
    • allocateFloatLocalArray

      float[] allocateFloatLocalArray(int size)
      Array Allocation in Local Memory (OpenCL terminology).
      Parameters:
      size - size of the float-array.
      Returns:
      float[]
    • allocateDoubleLocalArray

      double[] allocateDoubleLocalArray(int size)
      Array Allocation in Local Memory (OpenCL terminology).
      Parameters:
      size - size of the double-array.
      Returns:
      double[]
    • allocateByteLocalArray

      byte[] allocateByteLocalArray(int size)
      Array Allocation in Local Memory (OpenCL terminology).
      Parameters:
      size - size of the byte-array.
      Returns:
      byte[]
    • allocateHalfFloatLocalArray

      HalfFloat[] allocateHalfFloatLocalArray(int size)
      Array Allocation in Local Memory (OpenCL terminology).
      Parameters:
      size - size of the byte-array.
      Returns:
      HalfFloat[]
    • atomicAdd

      void atomicAdd(IntArray array, int index, int val)
      Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.

      PTX equivalent: atomicAdd(int* address, int val);

    • atomicAdd

      void atomicAdd(int[] array, int index, int val)
      Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.

      PTX equivalent: atomicAdd(int* address, int val);

    • atomicAdd

      void atomicAdd(LongArray array, int index, long val)
      Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.

      PTX equivalent: atomicAdd(long* address, long val);

    • atomicAdd

      void atomicAdd(FloatArray array, int index, float val)
      Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.

      PTX equivalent: atomicAdd(float* address, float val);

    • atomicAdd

      void atomicAdd(DoubleArray array, int index, double val)
      Method used to read a memory address by using the array and the index, then add the value of val to it, and write the result back to the same address.

      PTX equivalent: atomicAdd(double* address, double val);