PXL
pxl::Module Class Referenceabstract

A container for Function of MU kernel binary. More...

#include <module.hpp>

Public Member Functions

 Module (const Module &)=delete
 Deleted copy constructor. More...
 
Module & operator= (const Module &)=delete
 Deleted copy assignment operator. More...
 
virtual Function * createFunction (const char *muFuncName)=0
 Creates a Function object from the specified function name. More...
 
template<auto Func>
Function * createFunction ()
 Creates a Function object via compile-time KernelTraits lookup. More...
 
virtual void destroyFunction (Function *function)=0
 Destroys the specified Function object. More...
 
virtual std::string getMuBinaryPath () const =0
 Gets the binary path of the module. More...
 
virtual uint32_t getNumMuFunctions () const =0
 Gets the number of functions in the module. More...
 
virtual std::vector< std::string > getMuFunctionList () const =0
 Gets the name of MU functions in the module. More...
 

Protected Member Functions

 Module ()=default
 
virtual ~Module ()=default
 

Detailed Description

A container for Function of MU kernel binary.

A Module represents a MU Kernel Binary file, which is the output of the MU compiler. It acts as a container for Function objects that are intended for parallel execution on the MU. PXL utilizes the Module to schedule operations and coordinate their execution. It offers functionality for:

  • Creating and destroying Function objects
  • Querying module properties such as its binary path and the list of functions it contains

Definition at line 43 of file module.hpp.

Constructor & Destructor Documentation

◆ Module() [1/2]

pxl::Module::Module ( const Module &  )
delete

Deleted copy constructor.

◆ Module() [2/2]

pxl::Module::Module ( )
protecteddefault

◆ ~Module()

virtual pxl::Module::~Module ( )
protectedvirtualdefault

Member Function Documentation

◆ createFunction() [1/2]

template<auto Func>
Function* pxl::Module::createFunction ( )
inline

Creates a Function object via compile-time KernelTraits lookup.

Template Parameters
FuncKernel function pointer (must have a KernelTraits specialization).
Returns
Pointer to the created Function object, or nullptr if lookup fails.

Example usage:

auto module = pxl::createModule();
auto func = module->createFunction<vectorAdd>();
Module * createModule(const char *muBinaryPath)
Creates a Module object from the specified MU binary path.

Definition at line 87 of file module.hpp.

88  {
89  const char* kernelName = nullptr;
90 
91 #if defined(__PXCC_ANALYSIS__)
92  kernelName = "__pxcc_placeholder__";
93 #else
94  static_assert(sizeof(KernelTraits<Func>) > 0,
95  "Kernel function not found in KernelTraits — was it compiled with pxcc?");
96  kernelName = KernelTraits<Func>::name;
97 #endif
98 
99  return createFunction(kernelName);
100  }
Function * createFunction()
Creates a Function object via compile-time KernelTraits lookup.
Definition: module.hpp:87

◆ createFunction() [2/2]

virtual Function* pxl::Module::createFunction ( const char *  muFuncName)
pure virtual

Creates a Function object from the specified function name.

Parameters
muFuncNameName of the function to retrieve.
Returns
Pointer to the created Function object, or nullptr if creation fails.

Example usage:

auto module = pxl::createModule("test.mubin");
auto muFunc = module->createFunction("myFunction");
if (!muFunc)
{
// Handle function creation failure
}

◆ destroyFunction()

virtual void pxl::Module::destroyFunction ( Function *  function)
pure virtual

Destroys the specified Function object.

Parameters
functionPointer to the Function object to be destroyed.

Example usage:

auto module = pxl::createModule("test.mubin");
auto muFunc = module->createFunction("myFunction");
// Use the function
module->destroyFunction(muFunc);

◆ getMuBinaryPath()

virtual std::string pxl::Module::getMuBinaryPath ( ) const
pure virtual

Gets the binary path of the module.

Returns
Path to the MU binary file.

◆ getMuFunctionList()

virtual std::vector<std::string> pxl::Module::getMuFunctionList ( ) const
pure virtual

Gets the name of MU functions in the module.

Returns
Vector of function names in the module.

◆ getNumMuFunctions()

virtual uint32_t pxl::Module::getNumMuFunctions ( ) const
pure virtual

Gets the number of functions in the module.

Returns
Number of functions in the module.

◆ operator=()

Module& pxl::Module::operator= ( const Module &  )
delete

Deleted copy assignment operator.


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