tilework-metal 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Activates the Metal backend when `Tilework.backend = :metal` is selected.
4
+ #
5
+ # @note Raises {Tilework::DeviceError} when the native extension has not been built.
6
+ #
7
+ # `Tilework.backend = :metal` requires this conventional path
8
+ # (tilework/backend/<name>). If this file itself is missing, the gem is not
9
+ # installed and tilework.rb turns the LoadError into a DeviceError. A failure
10
+ # past this point means the gem is installed but the extension was not built,
11
+ # a different situation, so it is raised as its own DeviceError rather than
12
+ # a bare LoadError.
13
+ begin
14
+ require "tilework/metal/bridge"
15
+ rescue LoadError => e
16
+ raise Tilework::DeviceError,
17
+ "failed to load the Metal bridge (is the native extension built? run `rake compile` " \
18
+ "in the tilework-metal gem): #{e.message}"
19
+ end
20
+
21
+ Tilework.register_backend(:metal, Tilework::MetalBridge)
22
+
23
+ module Tilework::MetalBridge
24
+ # @api private
25
+ # core's math/*.rb report delegate library names assuming CUDA
26
+ # (:cublas/:curand/...). Metal implements the same ABI with MPS, so this
27
+ # overrides them with the real names for what is implemented — resolved
28
+ # here on the reporting side via respond_to?, without adding a backend-name
29
+ # branch to core (see CLAUDE.md).
30
+ def self.gemm_library_name = :mps
31
+ # MPS GEMM command buffers are committed onto the same Metal queue after
32
+ # flushing Tilework's open kernel batch, so Graph does not need host fences.
33
+ # A failure of one surfaces at the next `synchronize`.
34
+ def self.ordered_gemm? = true
35
+ def self.random_library_name = :mps
36
+ def self.fft_library_name = :mps
37
+ def self.conv_library_name = :mps
38
+ def self.gemm_supported_dtypes = %i[float32 float16 bfloat16]
39
+ def self.conv_supported_dtypes = %i[float32 float16 bfloat16]
40
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tilework-metal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.18.4
5
+ platform: ruby
6
+ authors:
7
+ - Kihaya Sugiura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tilework
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.18.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.18.0
27
+ description: 'The Metal backend gem for tilework: the native extension (ext/tilework/metal,
28
+ Swift + a C ABI shim). Depends on the tilework core gem for Buffer/Kernel/DSL/Ops
29
+ and the compat/metal.h dialect header.'
30
+ email:
31
+ - kihayas@gmail.com
32
+ executables: []
33
+ extensions:
34
+ - ext/tilework/metal/extconf.rb
35
+ extra_rdoc_files: []
36
+ files:
37
+ - LICENSE
38
+ - ext/tilework/metal/bridge.swift
39
+ - ext/tilework/metal/extconf.rb
40
+ - ext/tilework/metal/gpu_bridge.c
41
+ - lib/tilework/backend/metal.rb
42
+ homepage: https://github.com/kihaya/tilework
43
+ licenses:
44
+ - MIT
45
+ metadata:
46
+ rubygems_mfa_required: 'true'
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '3.1'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.5.22
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Metal backend for tilework
66
+ test_files: []