tilework-hip 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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +81 -0
- data/ext/tilework/hip/bridge.cpp +1067 -0
- data/ext/tilework/hip/extconf.rb +66 -0
- data/ext/tilework/hip/gpu_bridge.c +840 -0
- data/lib/tilework/backend/hip.rb +21 -0
- metadata +65 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c686cad6fe66e2e7380ebc3b61ccb3caccf547054b86dfda2cce04384a2eb400
|
|
4
|
+
data.tar.gz: 2c4131093a644dee566c972af726bcc473990f891a7af5bd798ee7b441332966
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b230eb82673c15887525ecdce7e45be72c394ddcfbabc57355f1cdc689854b553ed32773a51937a2616444b1d58a7102e7db9b16ec8f209991e570669daf2a59
|
|
7
|
+
data.tar.gz: 7fc0100e4c7e08b4860f3358f59c702b4d79782e10d6303a73f7cd4d3c4b8ff80a4de8928e02dbade4a3792a0480736f016989a983f3b0c1ae8c30d9264306cc
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kihaya Sugiura
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# tilework-hip
|
|
2
|
+
|
|
3
|
+
`tilework-hip` provides Tilework's AMD GPU backend through the HIP Runtime and
|
|
4
|
+
HIPRTC. Select it after requiring the gem's backend entry point:
|
|
5
|
+
|
|
6
|
+
```ruby
|
|
7
|
+
require "tilework"
|
|
8
|
+
require "tilework/backend/hip"
|
|
9
|
+
Tilework.backend = :hip
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Build
|
|
13
|
+
|
|
14
|
+
The initial qualification tuple is ROCm 7.2.0.70200, Radeon RX 9070
|
|
15
|
+
(`gfx1201`), Ubuntu 24.04 under WSL2, and Ruby 3.2.3. It is a recorded test
|
|
16
|
+
environment, not a product allow-list.
|
|
17
|
+
|
|
18
|
+
ROCm is optional at gem-install time. Without HIP Runtime and HIPRTC headers
|
|
19
|
+
and shared libraries beneath `ROCM_HOME` (default `/opt/rocm`), `extconf.rb`
|
|
20
|
+
creates a no-op Makefile so CPU-only, CUDA-only, and macOS installations remain
|
|
21
|
+
installable. Selecting `:hip` without the built extension raises an actionable
|
|
22
|
+
`Tilework::DeviceError`.
|
|
23
|
+
|
|
24
|
+
On a ROCm host install the matching Ruby development headers, then build:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
sudo apt install ruby3.2-dev
|
|
28
|
+
cd hip
|
|
29
|
+
rake clean && rake compile
|
|
30
|
+
GPU_TESTS=1 GPU_BACKEND=hip rake test:hip
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The base bridge needs HIP Runtime and HIPRTC. hipBLAS, hipRAND, hipFFT, and
|
|
34
|
+
MIOpen are detected independently; each capability remains unavailable until
|
|
35
|
+
its native execution probe succeeds.
|
|
36
|
+
|
|
37
|
+
## Runtime behavior
|
|
38
|
+
|
|
39
|
+
`TILEWORK_DEVICE` is a non-negative index into the process-visible HIP device
|
|
40
|
+
list. AMD visibility variables (for example `HIP_VISIBLE_DEVICES`) determine
|
|
41
|
+
that list before Tilework runs; `TILEWORK_DEVICE` indexes the resulting list.
|
|
42
|
+
An invalid value raises an error; it never falls back to device zero. Selection
|
|
43
|
+
is immutable once the native bridge has initialized.
|
|
44
|
+
HIPRTC targets the selected device's runtime-probed `gcnArchName`. HIP never
|
|
45
|
+
reports a CUDA compute capability and never enables TF32.
|
|
46
|
+
|
|
47
|
+
Inspect the verified runtime facts rather than inferring them from a GPU name:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
Tilework.backend = :hip
|
|
51
|
+
p Tilework::HIPBridge.device_info
|
|
52
|
+
# => { name: "AMD Radeon RX 9070", architecture: "gfx1201", index: 0 }
|
|
53
|
+
|
|
54
|
+
p Tilework.capabilities.to_h.slice(:warp_size, :memory_budget_bytes, :gemm_library,
|
|
55
|
+
:rng, :fft, :conv, :conv_backward, :tensor_core)
|
|
56
|
+
# => { warp_size: 32, memory_budget_bytes: ..., gemm_library: :hipblas,
|
|
57
|
+
# rng: :hiprand, fft: :hipfft, conv: :miopen, conv_backward: true,
|
|
58
|
+
# tensor_core: true }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Optional-library values are `nil`/`false` unless their executable probes pass.
|
|
62
|
+
|
|
63
|
+
The HIP backend supports explicit volatile host offload:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
buffer.offload_to_host!
|
|
67
|
+
buffer.restore!
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
HostBacking owns pageable host memory through TypedData and uses a bounded 1 MiB
|
|
71
|
+
pinned staging chunk when available, with a synchronous pageable fallback when
|
|
72
|
+
pinned memory cannot be allocated. On the qualified HIP stack,
|
|
73
|
+
`host_backing_async: true` means `restore_async!` returns a completion token;
|
|
74
|
+
use `restore_async!(async: false)` to force the synchronous path. A buffer is
|
|
75
|
+
not resident until `token.wait` completes. Graph residency can select this
|
|
76
|
+
transport explicitly:
|
|
77
|
+
|
|
78
|
+
```ruby
|
|
79
|
+
plan = graph.compile(vram: vram_bytes, backing: :host, host_budget: host_bytes)
|
|
80
|
+
```
|
|
81
|
+
|