MetalCompute 1.0
An API to make GPU compute calls easier
Loading...
Searching...
No Matches
MTLCompute::Kernel Class Reference

#include <MTLComputeKernel.hpp>

Public Member Functions

 Kernel (MTL::Device *gpu, const std::string &filename)
 Constructor for the Kernel class.
 
 Kernel (MTL::Device *gpu, const std::string &filename, const std::string &funcname)
 Constructor for the Kernel class with function name.
 
 Kernel ()=default
 Default constructor for the Kernel class.
 
 ~Kernel ()
 Destructor for the Kernel class.
 
std::vector< std::string > getFunctionNames ()
 Get the names of the functions in the library.
 
void useFunction (const std::string &funcname)
 Use a function in the library.
 
MTL::ComputePipelineState * getPLS ()
 Get the MTL::ComputePipelineState object.
 

Private Attributes

MTL::Device * gpu
 The Metal device object.
 
MTL::Library * library
 The Metal library object.
 
MTL::Function * function
 The Metal function object.
 
MTL::ComputePipelineState * pipeline
 The Metal compute pipeline state object.
 

Constructor & Destructor Documentation

◆ Kernel() [1/3]

MTLCompute::Kernel::Kernel ( MTL::Device * gpu,
const std::string & filename )
inline

Constructor for the Kernel class.

Takes in the GPU device and the filename of the Metal library and creates a new Kernel object and MTL::Library

Parameters
gpuThe GPU device
filenameThe filename of the Metal library

◆ Kernel() [2/3]

MTLCompute::Kernel::Kernel ( MTL::Device * gpu,
const std::string & filename,
const std::string & funcname )
inline

Constructor for the Kernel class with function name.

Takes in the GPU device, the filename of the Metal library, and the name of the function and creates a new Kernel object and MTL::Library. Also calls useFunction with the function name

Parameters
gpuThe GPU device
filenameThe filename of the Metal library
funcnameThe name of the function

◆ Kernel() [3/3]

MTLCompute::Kernel::Kernel ( )
default

Default constructor for the Kernel class.

◆ ~Kernel()

MTLCompute::Kernel::~Kernel ( )
inline

Destructor for the Kernel class.

Releases the library object

Member Function Documentation

◆ getFunctionNames()

std::vector< std::string > MTLCompute::Kernel::getFunctionNames ( )
inline

Get the names of the functions in the library.

Returns
A vector of strings containing the names of the functions in the library

◆ getPLS()

MTL::ComputePipelineState * MTLCompute::Kernel::getPLS ( )
inline

Get the MTL::ComputePipelineState object.

Returns
MTL::ComputePipelineState* The MTL::ComputePipelineState object

◆ useFunction()

void MTLCompute::Kernel::useFunction ( const std::string & funcname)
inline

Use a function in the library.

Takes in the name of a function in the library and creates a new function and compute pipeline state

Parameters
funcnameThe name of the function

Member Data Documentation

◆ function

MTL::Function* MTLCompute::Kernel::function
private

The Metal function object.

◆ gpu

MTL::Device* MTLCompute::Kernel::gpu
private

The Metal device object.

◆ library

MTL::Library* MTLCompute::Kernel::library
private

The Metal library object.

◆ pipeline

MTL::ComputePipelineState* MTLCompute::Kernel::pipeline
private

The Metal compute pipeline state object.


The documentation for this class was generated from the following file: