Module: Ignis
- Defined in:
- lib/nnw/shared/ffi_loader.rb,
lib/ignis.rb,
lib/nvruby/half.rb,
lib/nnw/platform.rb,
lib/nvruby/dtype.rb,
lib/nvruby/errors.rb,
lib/nvruby/memory.rb,
lib/nvruby/version.rb,
lib/nvruby/epilogues.rb,
lib/nvruby/cuda/graph.rb,
lib/nvruby/jit/kernel.rb,
lib/nvruby/cuda/device.rb,
lib/nvruby/cuda/memory.rb,
lib/nvruby/cuda/stream.rb,
lib/nnw/shared/nv_array.rb,
lib/nvruby/jit/compiler.rb,
lib/nvruby/memory/stats.rb,
lib/nnw/shared/event_bus.rb,
lib/nvruby/configuration.rb,
lib/nvruby/linalg/epilog.rb,
lib/nvruby/linalg/matmul.rb,
lib/nvruby/cuda/runtime_api.rb,
lib/nvruby/jit/kernels/loss.rb,
lib/nvruby/cuda/device_props.rb,
lib/nvruby/jit/kernel_module.rb,
lib/nvruby/jit/nvrtc_bindings.rb,
lib/nvruby/linalg/matmul_plan.rb,
lib/nnw/shared/memory_contract.rb,
lib/nvruby/cuda/graph_bindings.rb,
lib/nvruby/cuda/library_loader.rb,
lib/nvruby/jit/compiled_kernel.rb,
lib/nnw/shared/recovery_protocol.rb,
lib/nvruby/jit/kernels/attention.rb,
lib/nvruby/jit/kernels/optimizer.rb,
lib/nvruby/linalg/cublas_bindings.rb,
lib/nvruby/jit/driver_api_bindings.rb,
lib/nvruby/jit/kernels/activations.rb,
lib/nvruby/jit/kernels/elementwise.rb,
lib/nvruby/linalg/optimized_matmul.rb,
lib/nvruby/linalg/cublaslt_bindings.rb,
lib/nvruby/jit/kernels/normalization.rb,
lib/nvruby/memory/cuda_memory_resource.rb,
lib/nvruby/memory/pool_memory_resource.rb,
lib/nvruby/memory/device_memory_resource.rb,
lib/nvruby/memory/cuda_async_memory_resource.rb,
lib/nvruby/memory/pinned_host_memory_resource.rb
Overview
Ignis Shared FFI Loader
Centralizes the loading of the ruby-ffi gem across the entire Ignis platform. FFI is used ONLY for struct-heavy one-shot calls (device properties, VMM structs, etc.). All hot-path calls use Fiddle directly.
The FFI gem is installed system-wide in the MSVC Ruby build at:
C:\RubyMSVC34\lib\ruby\gems\3.4.0\gems\ffi-1.17.2\lib\ffi.rb
If a vendored copy exists at vendor/ffi/ inside the project root, it takes priority. This allows deploying to machines without system-installed FFI.
Defined Under Namespace
Modules: CUDA, DType, Epilogues, Half, JIT, LinAlg, Memory, Platform, Shared Classes: AutotuneError, Configuration, CuBLASError, CuFFTError, CuRANDError, CuSPARSEError, CuSolverError, CudaDriverError, CudaError, CudaRuntimeError, DeviceMemoryError, DimensionError, Error, HostMemoryError, InvalidOperationError, LibraryNotFoundError, MemoryError, NVRTCError, NoDeviceError, PlanError, UnsupportedDTypeError
Constant Summary collapse
- VERSION =
"0.1.0"- NDArray =
Public ecosystem alias: the one canonical GPU n-dimensional array. Internally the class lives at Ignis::Shared::NvArray (legacy path); Ignis::NDArray is the name the Ignis API exposes. (The nvmath-style Ignis::NvArray is a separate, deferred numerics array — see gems/MIGRATION.md.)
Ignis::Shared::NvArray
Class Method Summary collapse
- .clear_jit_cache! ⇒ Object
-
.compile_kernel(source, name, device_id: 0, options: []) ⇒ Object
— JIT kernel compilation (NVRTC) —.
- .compile_kernel_only(source, name, compute_capability:, options: []) ⇒ Object
-
.configuration ⇒ Configuration
Global configuration instance.
-
.configure {|Configuration| ... } ⇒ void
Configure Ignis.
- .cuda_available? ⇒ Boolean
- .cuda_version ⇒ Object
- .current_device ⇒ Object
-
.devices ⇒ Object
— Device management —.
-
.event_bus ⇒ Object
— Shared foundation accessors —.
-
.gemm(a, b, c: nil, alpha: 1.0, beta: 0.0, transpose_a: false, transpose_b: false, stream: nil) ⇒ Object
General GEMM: D = alpha*op(A)@op(B) + beta*C.
- .jit_cache_stats ⇒ Object
-
.logger ⇒ Logger
Logger instance.
-
.matmul(a, b, transpose_a: false, transpose_b: false) ⇒ Object
cuBLAS matrix multiply: C = A @ B (optionally transposed).
- .memory_contract ⇒ Object
- .recovery_protocol ⇒ Object
- .set_device(i) ⇒ Object
- .synchronize ⇒ Object
Class Method Details
.clear_jit_cache! ⇒ Object
87 |
# File 'lib/ignis.rb', line 87 def clear_jit_cache!; JIT::Compiler.clear_cache!; end |
.compile_kernel(source, name, device_id: 0, options: []) ⇒ Object
— JIT kernel compilation (NVRTC) —
78 79 80 |
# File 'lib/ignis.rb', line 78 def compile_kernel(source, name, device_id: 0, options: []) JIT::Compiler.compile(source, name, device_id: device_id, options: ) end |
.compile_kernel_only(source, name, compute_capability:, options: []) ⇒ Object
82 83 84 |
# File 'lib/ignis.rb', line 82 def compile_kernel_only(source, name, compute_capability:, options: []) JIT::Compiler.compile_only(source, name, compute_capability: compute_capability, options: ) end |
.configuration ⇒ Configuration
Returns Global configuration instance.
201 202 203 |
# File 'lib/nvruby/configuration.rb', line 201 def configuration @configuration ||= Configuration.new end |
.configure {|Configuration| ... } ⇒ void
This method returns an undefined value.
Configure Ignis
208 209 210 |
# File 'lib/nvruby/configuration.rb', line 208 def configure yield(configuration) if block_given? end |
.cuda_available? ⇒ Boolean
74 |
# File 'lib/ignis.rb', line 74 def cuda_available?; CUDA::Device.available?; rescue StandardError; false; end |
.cuda_version ⇒ Object
75 |
# File 'lib/ignis.rb', line 75 def cuda_version; CUDA::LibraryLoader.cuda_version; rescue StandardError; nil; end |
.current_device ⇒ Object
71 |
# File 'lib/ignis.rb', line 71 def current_device; CUDA::Device.current; end |
.devices ⇒ Object
— Device management —
70 |
# File 'lib/ignis.rb', line 70 def devices; CUDA::Device.list; end |
.event_bus ⇒ Object
— Shared foundation accessors —
90 |
# File 'lib/ignis.rb', line 90 def event_bus; Shared::EventBus; end |
.gemm(a, b, c: nil, alpha: 1.0, beta: 0.0, transpose_a: false, transpose_b: false, stream: nil) ⇒ Object
General GEMM: D = alpha*op(A)@op(B) + beta*C.
64 65 66 67 |
# File 'lib/ignis.rb', line 64 def gemm(a, b, c: nil, alpha: 1.0, beta: 0.0, transpose_a: false, transpose_b: false, stream: nil) LinAlg::Matmul.call(a, b, c: c, alpha: alpha, beta: beta, transpose_a: transpose_a, transpose_b: transpose_b, stream: stream) end |
.jit_cache_stats ⇒ Object
86 |
# File 'lib/ignis.rb', line 86 def jit_cache_stats; JIT::Compiler.cache_stats; end |
.logger ⇒ Logger
Returns Logger instance.
213 214 215 |
# File 'lib/nvruby/configuration.rb', line 213 def logger configuration.logger end |
.matmul(a, b, transpose_a: false, transpose_b: false) ⇒ Object
cuBLAS matrix multiply: C = A @ B (optionally transposed).
59 60 61 |
# File 'lib/ignis.rb', line 59 def matmul(a, b, transpose_a: false, transpose_b: false) LinAlg::Matmul.call(a, b, transpose_a: transpose_a, transpose_b: transpose_b) end |
.memory_contract ⇒ Object
91 |
# File 'lib/ignis.rb', line 91 def memory_contract; Shared::MemoryContract; end |
.recovery_protocol ⇒ Object
92 |
# File 'lib/ignis.rb', line 92 def recovery_protocol; Shared::RecoveryProtocol; end |
.set_device(i) ⇒ Object
72 |
# File 'lib/ignis.rb', line 72 def set_device(i); CUDA::Device.new(i).set_current!; end |
.synchronize ⇒ Object
73 |
# File 'lib/ignis.rb', line 73 def synchronize; CUDA::Device.current.synchronize; end |