pinokiod 8.0.44 → 8.0.46
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.
- package/kernel/gpu/amd_gfx_targets.json +3 -1
- package/kernel/gpu/amd_pci.js +184 -0
- package/kernel/gpu/amd_pci_targets.json +3243 -0
- package/kernel/sysinfo.js +6 -1
- package/kernel/vault/constants.js +2 -1
- package/kernel/vault/hash_worker.js +13 -1
- package/kernel/vault/index.js +89 -22
- package/kernel/vault/sweeper.js +15 -23
- package/package.json +2 -1
- package/script/update-amd-gfx-targets.js +289 -13
- package/server/lib/app_log_report.js +45 -3
- package/server/lib/log_redaction.js +26 -14
- package/server/public/nav.js +1 -1
- package/server/public/style.css +0 -1
- package/server/public/vault.css +2 -2
- package/server/public/vault.js +30 -33
- package/server/views/vault.ejs +2 -0
- package/test/amd-gfx-generator.test.js +75 -0
- package/test/amd-gpu-target.test.js +108 -10
- package/test/amd-pci-target.test.js +159 -0
- package/test/app-log-report.test.js +67 -0
- package/test/header-collapse.test.js +10 -5
- package/test/sysinfo-gpu-driver.test.js +4 -0
- package/test/vault-engine.test.js +166 -1
- package/test/vault-sweep.test.js +50 -31
- package/test/vault-ui.test.js +111 -21
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "https://raw.githubusercontent.com/ROCm/ROCm/
|
|
2
|
+
"source": "https://raw.githubusercontent.com/ROCm/ROCm/14f8138863403a26e0caef6671cfab9b09aa636e/docs/reference/gpu-arch-specs.rst",
|
|
3
|
+
"source_revision": "14f8138863403a26e0caef6671cfab9b09aa636e",
|
|
4
|
+
"source_sha256": "24bbbc77da046c5eabf8255c508bb328ffc052d84c8e2842b78f89f482a0d412",
|
|
3
5
|
"generated_by": "script/update-amd-gfx-targets.js",
|
|
4
6
|
"entries": {
|
|
5
7
|
"mi100": "gfx908",
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
const childProcess = require("node:child_process")
|
|
2
|
+
const fs = require("node:fs")
|
|
3
|
+
const path = require("node:path")
|
|
4
|
+
const util = require("node:util")
|
|
5
|
+
|
|
6
|
+
const { normalize_model } = require("./common")
|
|
7
|
+
const amd_pci_targets = require("./amd_pci_targets.json")
|
|
8
|
+
|
|
9
|
+
const execFile = util.promisify(childProcess.execFile)
|
|
10
|
+
const AMD_VENDOR_ID = "1002"
|
|
11
|
+
const WINDOWS_GPU_QUERY = [
|
|
12
|
+
"Get-CimInstance Win32_VideoController",
|
|
13
|
+
"Select-Object Name,PNPDeviceID",
|
|
14
|
+
"ConvertTo-Json -Compress"
|
|
15
|
+
].join(" | ")
|
|
16
|
+
|
|
17
|
+
let windows_adapters
|
|
18
|
+
|
|
19
|
+
const normalize_hex = (value, length) => {
|
|
20
|
+
if (typeof value === "number" && Number.isInteger(value) && value >= 0) {
|
|
21
|
+
let numeric = value.toString(16).padStart(length, "0")
|
|
22
|
+
return numeric.length === length ? numeric : null
|
|
23
|
+
}
|
|
24
|
+
let normalized = String(value || "")
|
|
25
|
+
.trim()
|
|
26
|
+
.toLowerCase()
|
|
27
|
+
.replace(/^0x/, "")
|
|
28
|
+
return new RegExp(`^[0-9a-f]{${length}}$`).test(normalized) ? normalized : null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const parse_pci_identity = (record) => {
|
|
32
|
+
if (!record) return null
|
|
33
|
+
|
|
34
|
+
let encoded = [
|
|
35
|
+
record.pnpDeviceId,
|
|
36
|
+
record.PNPDeviceID,
|
|
37
|
+
record.pnp_device_id,
|
|
38
|
+
record.deviceId,
|
|
39
|
+
record.deviceID
|
|
40
|
+
].find((value) => typeof value === "string" && /VEN_|DEV_/i.test(value))
|
|
41
|
+
if (encoded) {
|
|
42
|
+
let match = /VEN_([0-9a-f]{4})&DEV_([0-9a-f]{4})(?:&SUBSYS_[0-9a-f]{8})?(?:&REV_([0-9a-f]{2}))?/i.exec(encoded)
|
|
43
|
+
if (match) {
|
|
44
|
+
return {
|
|
45
|
+
vendor: match[1].toLowerCase(),
|
|
46
|
+
device: match[2].toLowerCase(),
|
|
47
|
+
revision: match[3] ? match[3].toLowerCase() : null
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let vendor = normalize_hex(record.vendorId || record.vendorID || record.vendor_id, 4)
|
|
53
|
+
let device = normalize_hex(record.deviceId || record.deviceID || record.device_id, 4)
|
|
54
|
+
let revision = normalize_hex(record.revision || record.revisionId || record.revision_id, 2)
|
|
55
|
+
return vendor && device ? { vendor, device, revision } : null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const resolve_pci_target = (identity) => {
|
|
59
|
+
if (!identity) return null
|
|
60
|
+
let vendor = normalize_hex(identity.vendor, 4)
|
|
61
|
+
let device = normalize_hex(identity.device, 4)
|
|
62
|
+
let revision = normalize_hex(identity.revision, 2)
|
|
63
|
+
if (!vendor || !device) return null
|
|
64
|
+
|
|
65
|
+
let revision_entry = revision && amd_pci_targets.revision_entries[
|
|
66
|
+
`${vendor}:${device}:${revision}`
|
|
67
|
+
]
|
|
68
|
+
let entry = revision_entry || amd_pci_targets.entries[`${vendor}:${device}`]
|
|
69
|
+
return entry && /^gfx[0-9a-f]+$/i.test(entry.target || "")
|
|
70
|
+
? entry.target.toLowerCase()
|
|
71
|
+
: null
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const parse_windows_output = (stdout) => {
|
|
75
|
+
let json = String(stdout || "").trim().replace(/^\uFEFF/, "")
|
|
76
|
+
if (!json) return []
|
|
77
|
+
let parsed = JSON.parse(json)
|
|
78
|
+
let records = Array.isArray(parsed) ? parsed : [parsed]
|
|
79
|
+
return records.map((record) => ({
|
|
80
|
+
model: record.Name || record.name || "",
|
|
81
|
+
pnpDeviceId: record.PNPDeviceID || record.pnpDeviceId || ""
|
|
82
|
+
}))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const query_windows_adapters = async (options = {}) => {
|
|
86
|
+
let run = options.execFile || execFile
|
|
87
|
+
try {
|
|
88
|
+
let result = await run(
|
|
89
|
+
"powershell.exe",
|
|
90
|
+
["-NoProfile", "-NonInteractive", "-Command", WINDOWS_GPU_QUERY],
|
|
91
|
+
{ windowsHide: true, timeout: 5000, maxBuffer: 1024 * 1024 }
|
|
92
|
+
)
|
|
93
|
+
return parse_windows_output(result && result.stdout)
|
|
94
|
+
} catch (_) {
|
|
95
|
+
return []
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const windows_identity = async (controller, options = {}) => {
|
|
100
|
+
let records
|
|
101
|
+
if (options.execFile) {
|
|
102
|
+
records = await query_windows_adapters(options)
|
|
103
|
+
} else {
|
|
104
|
+
if (!windows_adapters) {
|
|
105
|
+
windows_adapters = query_windows_adapters()
|
|
106
|
+
}
|
|
107
|
+
records = await windows_adapters
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let model = normalize_model(controller && controller.model)
|
|
111
|
+
if (!model) return null
|
|
112
|
+
let matches = records.filter((record) => (
|
|
113
|
+
normalize_model(record.model) === model &&
|
|
114
|
+
parse_pci_identity(record)?.vendor === AMD_VENDOR_ID
|
|
115
|
+
))
|
|
116
|
+
return matches.length === 1 ? parse_pci_identity(matches[0]) : null
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const normalize_bus_address = (value) => {
|
|
120
|
+
let address = String(value || "").trim().toLowerCase()
|
|
121
|
+
if (/^[0-9a-f]{2}:[0-9a-f]{2}\.[0-7]$/.test(address)) {
|
|
122
|
+
return `0000:${address}`
|
|
123
|
+
}
|
|
124
|
+
return /^[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-7]$/.test(address)
|
|
125
|
+
? address
|
|
126
|
+
: null
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const linux_identity = async (controller, options = {}) => {
|
|
130
|
+
let address = normalize_bus_address(
|
|
131
|
+
controller && (controller.busAddress || controller.pciBus)
|
|
132
|
+
)
|
|
133
|
+
if (!address) return null
|
|
134
|
+
|
|
135
|
+
let sysfs_root = options.sysfsRoot || "/sys/bus/pci/devices"
|
|
136
|
+
let readFile = options.readFile || fs.promises.readFile
|
|
137
|
+
try {
|
|
138
|
+
let device_path = path.join(sysfs_root, address)
|
|
139
|
+
let [vendorId, deviceId, revisionId] = await Promise.all([
|
|
140
|
+
readFile(path.join(device_path, "vendor"), "utf8"),
|
|
141
|
+
readFile(path.join(device_path, "device"), "utf8"),
|
|
142
|
+
readFile(path.join(device_path, "revision"), "utf8").catch(() => "")
|
|
143
|
+
])
|
|
144
|
+
return parse_pci_identity({ vendorId, deviceId, revisionId })
|
|
145
|
+
} catch (_) {
|
|
146
|
+
return null
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const resolve_gpu_target = async (controller, options = {}) => {
|
|
151
|
+
let direct_identity = parse_pci_identity(controller)
|
|
152
|
+
if (direct_identity && direct_identity.vendor === AMD_VENDOR_ID) {
|
|
153
|
+
return resolve_pci_target(direct_identity)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let platform = options.platform || process.platform
|
|
157
|
+
let identity = platform === "win32"
|
|
158
|
+
? await windows_identity(controller, options)
|
|
159
|
+
: platform === "linux"
|
|
160
|
+
? await linux_identity(controller, options)
|
|
161
|
+
: null
|
|
162
|
+
return identity && identity.vendor === AMD_VENDOR_ID
|
|
163
|
+
? resolve_pci_target(identity)
|
|
164
|
+
: null
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const reset_cache = () => {
|
|
168
|
+
windows_adapters = null
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
module.exports = {
|
|
172
|
+
AMD_VENDOR_ID,
|
|
173
|
+
WINDOWS_GPU_QUERY,
|
|
174
|
+
linux_identity,
|
|
175
|
+
normalize_hex,
|
|
176
|
+
normalize_bus_address,
|
|
177
|
+
parse_pci_identity,
|
|
178
|
+
parse_windows_output,
|
|
179
|
+
query_windows_adapters,
|
|
180
|
+
reset_cache,
|
|
181
|
+
resolve_gpu_target,
|
|
182
|
+
resolve_pci_target,
|
|
183
|
+
windows_identity
|
|
184
|
+
}
|