nvrtc_module Derived Type

type, public :: nvrtc_module

Class for managing nvRTC compiled CUDA kernels


Inherits

type~~nvrtc_module~~InheritsGraph type~nvrtc_module nvrtc_module type~cumodule CUmodule type~nvrtc_module->type~cumodule cumod type~kernel_config kernel_config type~nvrtc_module->type~kernel_config configs type~kernel_type_t kernel_type_t type~nvrtc_module->type~kernel_type_t kernel_type type~nvrtcprogram nvrtcProgram type~nvrtc_module->type~nvrtcprogram prog c_ptr c_ptr type~cumodule->c_ptr ptr type~nvrtcprogram->c_ptr cptr

Inherited by

type~~nvrtc_module~~InheritedByGraph type~nvrtc_module nvrtc_module type~nvrtc_module_cache nvrtc_module_cache type~nvrtc_module_cache->type~nvrtc_module cache

Components

Type Visibility Attributes Name Initial
logical, private :: is_created = .false.

Is module created

character(len=:), private, allocatable :: basic_name

Basic kernel name

integer(kind=int32), private :: ndims

Number of dimensions, used only for forward permutation

type(CUmodule), private :: cumod

CUDA module

type(nvrtcProgram), private :: prog

nvRTC program

type(kernel_type_t), private :: kernel_type

Type of kernel

integer(kind=int64), private :: base_storage

Number of bytes needed to store single element

type(kernel_config), private, allocatable :: configs(:)

Kernel configurations that this module was compiled for


Type-Bound Procedures

procedure, public, pass(self) :: create

Creates module with given parameters

  • private subroutine create(self, ndims, kernel_type, base_storage, configs, props)

    Creates module with given parameters, compiles nvRTC program and loads it as CUDA module

    Arguments

    Type IntentOptional Attributes Name
    class(nvrtc_module), intent(inout) :: self

    This module

    integer(kind=int32), intent(in) :: ndims

    Number of dimensions, used only for forward permutation

    type(kernel_type_t), intent(in) :: kernel_type

    Type of kernel to build

    integer(kind=int64), intent(in) :: base_storage

    Number of bytes needed to store single element

    type(kernel_config), intent(in) :: configs(:)

    Kernel configurations that this module should be compiled for

    type(device_props), intent(in) :: props

    GPU architecture properties

procedure, public, pass(self) :: destroy

Destroys module and frees resources

  • private subroutine destroy(self)

    Destroys module and frees resources

    Arguments

    Type IntentOptional Attributes Name
    class(nvrtc_module), intent(inout) :: self

procedure, public, pass(self) :: get

Returns kernel ready to be executed

  • private function get(self, ndims, kernel_type, base_storage, tile_size, block_rows) result(fun)

    Returns kernel ready to be executed

    Arguments

    Type IntentOptional Attributes Name
    class(nvrtc_module), intent(in) :: self

    This module

    integer(kind=int32), intent(in) :: ndims

    Number of dimensions, used only for forward permutation

    type(kernel_type_t), intent(in) :: kernel_type

    Type of kernel to build

    integer(kind=int64), intent(in) :: base_storage

    Number of bytes needed to store single element

    integer(kind=int32), intent(in) :: tile_size

    Size of shared memory tile, template parameter

    integer(kind=int32), intent(in) :: block_rows

    Number of rows processed by single thread, template parameter

    Return Value type(CUfunction)

    Resulting kernel

generic, public :: check => check_instance, check_module

Checks if kernel is with given parameters is available in this module

  • private function check_instance(self, ndims, kernel_type, base_storage, tile_size, block_rows)

    Checks if kernel with given parameters is available in this module

    Arguments

    Type IntentOptional Attributes Name
    class(nvrtc_module), intent(in) :: self

    This module

    integer(kind=int32), intent(in) :: ndims

    Number of dimensions

    type(kernel_type_t), intent(in) :: kernel_type

    Type of kernel to build

    integer(kind=int64), intent(in) :: base_storage

    Number of bytes needed to store single element

    integer(kind=int32), intent(in) :: tile_size

    Size of shared memory tile, template parameter

    integer(kind=int32), intent(in) :: block_rows

    Number of rows processed by single thread, template parameter

    Return Value logical

  • private function check_module(self, ndims, kernel_type, base_storage)

    Basic check that this module provides kernels of given type

    Arguments

    Type IntentOptional Attributes Name
    class(nvrtc_module), intent(in) :: self

    This module

    integer(kind=int32), intent(in) :: ndims

    Number of dimensions

    type(kernel_type_t), intent(in) :: kernel_type

    Type of kernel to build

    integer(kind=int64), intent(in) :: base_storage

    Number of bytes needed to store single element

    Return Value logical

procedure, private, pass(self) :: check_instance

Checks if kernel with given parameters is available in this module

  • private function check_instance(self, ndims, kernel_type, base_storage, tile_size, block_rows)

    Checks if kernel with given parameters is available in this module

    Arguments

    Type IntentOptional Attributes Name
    class(nvrtc_module), intent(in) :: self

    This module

    integer(kind=int32), intent(in) :: ndims

    Number of dimensions

    type(kernel_type_t), intent(in) :: kernel_type

    Type of kernel to build

    integer(kind=int64), intent(in) :: base_storage

    Number of bytes needed to store single element

    integer(kind=int32), intent(in) :: tile_size

    Size of shared memory tile, template parameter

    integer(kind=int32), intent(in) :: block_rows

    Number of rows processed by single thread, template parameter

    Return Value logical

procedure, private, pass(self) :: check_module

Basic check that this module provides kernels of given type

  • private function check_module(self, ndims, kernel_type, base_storage)

    Basic check that this module provides kernels of given type

    Arguments

    Type IntentOptional Attributes Name
    class(nvrtc_module), intent(in) :: self

    This module

    integer(kind=int32), intent(in) :: ndims

    Number of dimensions

    type(kernel_type_t), intent(in) :: kernel_type

    Type of kernel to build

    integer(kind=int64), intent(in) :: base_storage

    Number of bytes needed to store single element

    Return Value logical