Module: Cumo::CUDA::UserKernel

Included in:
ElementwiseKernel, ReductionKernel
Defined in:
lib/cumo/cuda/user_kernel.rb

Overview

What ElementwiseKernel and ReductionKernel share: the parameter syntax, the dtype table, how a type letter is resolved and how arguments are broadcast and handed to the launch.

Defined Under Namespace

Classes: Param

Constant Summary collapse

TYPES =
{
  "float64" => [Cumo::DFloat, "double", "d"],
  "float32" => [Cumo::SFloat, "float", "f"],
  "int64" => [Cumo::Int64, "long long", "q"],
  "int32" => [Cumo::Int32, "int", "l"],
  "int16" => [Cumo::Int16, "short", "s"],
  "int8" => [Cumo::Int8, "signed char", "c"],
  "uint64" => [Cumo::UInt64, "unsigned long long", "Q"],
  "uint32" => [Cumo::UInt32, "unsigned int", "L"],
  "uint16" => [Cumo::UInt16, "unsigned short", "S"],
  "uint8" => [Cumo::UInt8, "unsigned char", "C"],
}.freeze
CTYPE =
TYPES.values.to_h { |klass, ctype, _| [klass, ctype] }.freeze
PACK =
TYPES.values.to_h { |klass, _, pack| [klass, pack] }.freeze
INT_RANGE =
{
  Cumo::Int64 => (-2**63...2**63), Cumo::Int32 => (-2**31...2**31),
  Cumo::Int16 => (-2**15...2**15), Cumo::Int8 => (-2**7...2**7),
  Cumo::UInt64 => (0...2**64), Cumo::UInt32 => (0...2**32),
  Cumo::UInt16 => (0...2**16), Cumo::UInt8 => (0...2**8),
}.freeze
RESERVED =
/\A(i|n)\z|\A_/