@danielsimonjr/mathts-functions 0.20.2 → 0.21.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elementwise-gpu.d.ts","sourceRoot":"","sources":["../../src/gpu/elementwise-gpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"elementwise-gpu.d.ts","sourceRoot":"","sources":["../../src/gpu/elementwise-gpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAQL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AA+CnC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;CAgCR,CAAC;AAEX,uEAAuE;AACvE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,YAAY,CAAC;AAEzD,eAAO,MAAM,mBAAmB,EAAE,SAAS,gBAAgB,EAEpC,CAAC;AAExB,sDAAsD;AACtD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,IAAI,SAAS,gBAAgB,EAAE,CAE9F;AAoCD,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAIhD,eAAO,MAAM,cAAc,gCAAkE,CAAC;AAwG9F,uEAAuE;AACvE,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,EAAE,EAAE,YAAY,GAAG,YAAY,EAC/B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAE9B;AA8ID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,EAAE,EAAE,YAAY,GAAG,YAAY,EAC/B,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAExB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGPU FFT — Stockham autosort, radix-2, f32.
|
|
3
|
+
*
|
|
4
|
+
* Why Stockham rather than the textbook Cooley-Tukey the CPU core uses: it is
|
|
5
|
+
* **self-sorting**. Each pass reads one buffer and scatters into another, so the output
|
|
6
|
+
* comes out in natural order with **no bit-reversal permutation pass** — and a bit-reversal
|
|
7
|
+
* is a pure memory shuffle, which is the one thing a GPU is worst at. The ping-pong between
|
|
8
|
+
* two buffers is also exactly the access pattern the hardware wants.
|
|
9
|
+
*
|
|
10
|
+
* ### Is it worth it? (see `FFT_GPU_MIN_ELEMENTS` for the full table)
|
|
11
|
+
*
|
|
12
|
+
* Chrome / NVIDIA Pascal, warm JIT, against `fftCoreFloat64` — the flat f64 core that
|
|
13
|
+
* `parallelFFT` runs on this thread:
|
|
14
|
+
*
|
|
15
|
+
* | n | CPU f64 | GPU f32 | speedup |
|
|
16
|
+
* | --------- | -------- | -------- | --------- |
|
|
17
|
+
* | 65,536 | 16.8 ms | 14.4 ms | 1.17× |
|
|
18
|
+
* | 262,144 | 53.4 ms | 24.0 ms | **2.23×** |
|
|
19
|
+
* | 1,048,576 | 253.1 ms | 79.7 ms | **3.18×** |
|
|
20
|
+
* | 2,097,152 | 399.9 ms | 116.3 ms | **3.44×** |
|
|
21
|
+
*
|
|
22
|
+
* (~2.2-3.4x, and the ratio is genuinely noisy run to run — regenerate it with
|
|
23
|
+
* `gpu-fft-bench.browser.test.ts` rather than trusting a single hero number. f32 error is
|
|
24
|
+
* ~4e-7 peak-relative at every size above.)
|
|
25
|
+
*
|
|
26
|
+
* Two things decided the design:
|
|
27
|
+
*
|
|
28
|
+
* - **The threshold is 262,144, NOT `GPU_MIN_ELEMENTS`.** At 65,536 the GPU wins by 1.17×,
|
|
29
|
+
* which is inside the noise and nowhere near enough to justify dropping f64 for f32. An
|
|
30
|
+
* FFT makes log2(n) passes over the data, so it amortises the upload more slowly than the
|
|
31
|
+
* memory-bound element-wise chain does. Sharing one threshold would have been convenient
|
|
32
|
+
* and wrong.
|
|
33
|
+
* - **f32 accuracy holds.** Error growth across log2(n) stages was the real risk — it is why
|
|
34
|
+
* an f32 FFT is a harder sell than an f32 element-wise chain. Measured ~4e-7 relative to
|
|
35
|
+
* the spectrum's peak magnitude even at 20 stages, a few times f32 epsilon. Stockham is
|
|
36
|
+
* numerically well-behaved; the error did not compound.
|
|
37
|
+
*
|
|
38
|
+
* An earlier revision of this comment claimed 5.0-8.5x. That came from a COLD-JIT CPU
|
|
39
|
+
* baseline and from comparing against a CPU path `parallelFFT` did not actually take. Both
|
|
40
|
+
* are fixed; the numbers above are warm, and measured against the path it really runs.
|
|
41
|
+
*
|
|
42
|
+
* Same never-throw contract as the rest of the GPU surface: returns `null` — never rejects —
|
|
43
|
+
* whenever the GPU is unavailable, not opted into, the input is below threshold, not a power
|
|
44
|
+
* of two, or a device limit is exceeded. The caller then uses the exact f64 CPU path.
|
|
45
|
+
*
|
|
46
|
+
* @packageDocumentation
|
|
47
|
+
*/
|
|
48
|
+
import { type GPUContextOptions } from '@danielsimonjr/mathts-gpu';
|
|
49
|
+
/** Drop cached shaders/buffers (device loss, or between tests). */
|
|
50
|
+
export declare function resetGpuFft(): void;
|
|
51
|
+
/** Options for the GPU FFT. `gpu` overrides the process-global `enableGpu()` flag. */
|
|
52
|
+
export interface GpuFftOptions extends GPUContextOptions {
|
|
53
|
+
/** Force the GPU on/off for this call, ignoring the global flag. */
|
|
54
|
+
gpu?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** Result of a GPU FFT: f32-precision values widened into the f64 container. */
|
|
57
|
+
export interface GpuFftResult {
|
|
58
|
+
real: Float64Array;
|
|
59
|
+
imag: Float64Array;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Run an FFT on the GPU.
|
|
63
|
+
*
|
|
64
|
+
* `real`/`imag` must be the same length, a power of two, and at least `FFT_GPU_MIN_ELEMENTS`
|
|
65
|
+
* (262,144) — below that the GPU's margin (1.17× at 65,536) does not justify dropping f64 for
|
|
66
|
+
* f32, so this declines and the caller keeps the exact CPU path.
|
|
67
|
+
*
|
|
68
|
+
* Returns `null` rather than throwing whenever it cannot or should not run, so the caller
|
|
69
|
+
* simply falls through to the exact f64 CPU path.
|
|
70
|
+
*
|
|
71
|
+
* Precision: f32 (~4e-7 relative to the spectrum's peak, measured through 20 stages).
|
|
72
|
+
* `enableGpu()` is how a caller consents to that.
|
|
73
|
+
*/
|
|
74
|
+
export declare function fftGpuDispatch(real: Float64Array, imag: Float64Array, inverse?: boolean, options?: GpuFftOptions): Promise<GpuFftResult | null>;
|
|
75
|
+
//# sourceMappingURL=fft-gpu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fft-gpu.d.ts","sourceRoot":"","sources":["../../src/gpu/fft-gpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAqGnC,mEAAmE;AACnE,wBAAgB,WAAW,IAAI,IAAI,CAKlC;AA6BD,sFAAsF;AACtF,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,oEAAoE;IACpE,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,YAAY,EAClB,OAAO,UAAQ,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAe9B"}
|
package/dist/index.js
CHANGED
|
@@ -184,6 +184,7 @@ __export(typed_exports, {
|
|
|
184
184
|
factor: () => factor,
|
|
185
185
|
fallingFactorial: () => fallingFactorial,
|
|
186
186
|
fft2d: () => fft2d,
|
|
187
|
+
fftGpuDispatch: () => fftGpuDispatch,
|
|
187
188
|
fibonacci: () => fibonacci,
|
|
188
189
|
findRoot: () => findRoot,
|
|
189
190
|
fix: () => fix,
|
|
@@ -240,7 +241,7 @@ __export(typed_exports, {
|
|
|
240
241
|
invGaussDist: () => invGaussDist,
|
|
241
242
|
isConnected: () => isConnected,
|
|
242
243
|
isGpuChainSupported: () => isGpuChainSupported,
|
|
243
|
-
isGpuEnabled: () =>
|
|
244
|
+
isGpuEnabled: () => isGpuEnabled3,
|
|
244
245
|
jacobiSymbol: () => jacobiSymbol,
|
|
245
246
|
jordanForm: () => jordanForm,
|
|
246
247
|
jsDivergence: () => jsDivergence,
|
|
@@ -400,6 +401,7 @@ __export(typed_exports, {
|
|
|
400
401
|
reflectVector: () => reflectVector,
|
|
401
402
|
resample: () => resample,
|
|
402
403
|
resetGpuElementwise: () => resetGpuElementwise,
|
|
404
|
+
resetGpuFft: () => resetGpuFft,
|
|
403
405
|
residue: () => residue,
|
|
404
406
|
resultant: () => resultant,
|
|
405
407
|
rightArithShift: () => rightArithShift,
|
|
@@ -3256,6 +3258,179 @@ function fftCoreFloat64(realIn, imagIn, inverse = false) {
|
|
|
3256
3258
|
return { real, imag };
|
|
3257
3259
|
}
|
|
3258
3260
|
|
|
3261
|
+
// src/gpu/fft-gpu.ts
|
|
3262
|
+
import {
|
|
3263
|
+
getGpuDevice,
|
|
3264
|
+
getGlobalGPUContext,
|
|
3265
|
+
isGpuEnabled,
|
|
3266
|
+
ShaderManager,
|
|
3267
|
+
BufferPool,
|
|
3268
|
+
serializeGpu
|
|
3269
|
+
} from "@danielsimonjr/mathts-gpu";
|
|
3270
|
+
var WORKGROUP_SIZE = 64;
|
|
3271
|
+
var FFT_GPU_MIN_ELEMENTS = 262144;
|
|
3272
|
+
var SHADER_KEY = "fft:stockham";
|
|
3273
|
+
var STOCKHAM_WGSL = `
|
|
3274
|
+
@group(0) @binding(0) var<storage, read> src: array<vec2<f32>>;
|
|
3275
|
+
@group(0) @binding(1) var<storage, read_write> dst: array<vec2<f32>>;
|
|
3276
|
+
@group(0) @binding(2) var<uniform> params: vec4<u32>; // n, ns, inverse, _
|
|
3277
|
+
|
|
3278
|
+
fn cmul(a: vec2<f32>, b: vec2<f32>) -> vec2<f32> {
|
|
3279
|
+
return vec2<f32>(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
@compute @workgroup_size(${WORKGROUP_SIZE})
|
|
3283
|
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
3284
|
+
let n = params.x;
|
|
3285
|
+
let ns = params.y;
|
|
3286
|
+
let half = n / 2u;
|
|
3287
|
+
let i = gid.x;
|
|
3288
|
+
if (i >= half) { return; }
|
|
3289
|
+
|
|
3290
|
+
// -1 forward, +1 inverse \u2014 the same sign convention as the CPU core, so the two
|
|
3291
|
+
// implementations agree on which direction is which.
|
|
3292
|
+
let sgn = select(-1.0, 1.0, params.z == 1u);
|
|
3293
|
+
let angle = sgn * 2.0 * 3.14159265358979323846 * f32(i % ns) / f32(ns * 2u);
|
|
3294
|
+
let tw = vec2<f32>(cos(angle), sin(angle));
|
|
3295
|
+
|
|
3296
|
+
let v0 = src[i];
|
|
3297
|
+
let v1 = cmul(src[i + half], tw);
|
|
3298
|
+
|
|
3299
|
+
let idxD = (i / ns) * ns * 2u + (i % ns);
|
|
3300
|
+
dst[idxD] = v0 + v1;
|
|
3301
|
+
dst[idxD + ns] = v0 - v1;
|
|
3302
|
+
}
|
|
3303
|
+
`;
|
|
3304
|
+
var resources = null;
|
|
3305
|
+
async function getResources(options) {
|
|
3306
|
+
const device = await getGpuDevice(options);
|
|
3307
|
+
if (!device) return null;
|
|
3308
|
+
if (resources && resources.device === device) return resources;
|
|
3309
|
+
if (resources) resetGpuFft();
|
|
3310
|
+
const ctx = getGlobalGPUContext();
|
|
3311
|
+
const shaders = new ShaderManager(ctx);
|
|
3312
|
+
shaders.registerShader(SHADER_KEY, STOCKHAM_WGSL);
|
|
3313
|
+
shaders.precompileRegistered();
|
|
3314
|
+
resources = { device, shaders, pool: new BufferPool(ctx), stageUniforms: /* @__PURE__ */ new Map() };
|
|
3315
|
+
return resources;
|
|
3316
|
+
}
|
|
3317
|
+
function resetGpuFft() {
|
|
3318
|
+
if (!resources) return;
|
|
3319
|
+
for (const bufs of resources.stageUniforms.values()) bufs.forEach((b) => b.destroy());
|
|
3320
|
+
resources.pool.destroy();
|
|
3321
|
+
resources = null;
|
|
3322
|
+
}
|
|
3323
|
+
function stageUniformsFor(res, n, inverse) {
|
|
3324
|
+
const key = `${n}:${inverse ? 1 : 0}`;
|
|
3325
|
+
const cached = res.stageUniforms.get(key);
|
|
3326
|
+
if (cached) return cached;
|
|
3327
|
+
const stages = Math.log2(n);
|
|
3328
|
+
const bufs = [];
|
|
3329
|
+
for (let s = 0, ns = 1; s < stages; s++, ns *= 2) {
|
|
3330
|
+
const u = res.device.createBuffer({
|
|
3331
|
+
size: 16,
|
|
3332
|
+
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
|
|
3333
|
+
label: `fft-stage-${s}`
|
|
3334
|
+
});
|
|
3335
|
+
res.device.queue.writeBuffer(u, 0, new Uint32Array([n, ns, inverse ? 1 : 0, 0]));
|
|
3336
|
+
bufs.push(u);
|
|
3337
|
+
}
|
|
3338
|
+
res.stageUniforms.set(key, bufs);
|
|
3339
|
+
return bufs;
|
|
3340
|
+
}
|
|
3341
|
+
var isPowerOf2 = (n) => n > 0 && (n & n - 1) === 0;
|
|
3342
|
+
function fftGpuDispatch(real, imag, inverse = false, options) {
|
|
3343
|
+
const n = real.length;
|
|
3344
|
+
if (!(options?.gpu ?? isGpuEnabled())) return Promise.resolve(null);
|
|
3345
|
+
if (imag.length !== n) return Promise.resolve(null);
|
|
3346
|
+
if (n < FFT_GPU_MIN_ELEMENTS) return Promise.resolve(null);
|
|
3347
|
+
if (!isPowerOf2(n)) return Promise.resolve(null);
|
|
3348
|
+
return serializeGpu(() => fftGpuDispatchImpl(real, imag, inverse, options));
|
|
3349
|
+
}
|
|
3350
|
+
async function fftGpuDispatchImpl(real, imag, inverse, options) {
|
|
3351
|
+
const n = real.length;
|
|
3352
|
+
const bytes = n * 8;
|
|
3353
|
+
const workgroups = Math.ceil(n / 2 / WORKGROUP_SIZE);
|
|
3354
|
+
let res;
|
|
3355
|
+
let bufA;
|
|
3356
|
+
let bufB;
|
|
3357
|
+
let staging;
|
|
3358
|
+
let scopePushed = false;
|
|
3359
|
+
let scopePopped = false;
|
|
3360
|
+
try {
|
|
3361
|
+
const r = await getResources(options);
|
|
3362
|
+
if (!r) return null;
|
|
3363
|
+
res = r;
|
|
3364
|
+
const { device, shaders, pool } = r;
|
|
3365
|
+
const limits = device.limits;
|
|
3366
|
+
if (workgroups > limits.maxComputeWorkgroupsPerDimension) return null;
|
|
3367
|
+
if (bytes > limits.maxStorageBufferBindingSize) return null;
|
|
3368
|
+
if (bytes > limits.maxBufferSize) return null;
|
|
3369
|
+
const stageUniforms = stageUniformsFor(r, n, inverse);
|
|
3370
|
+
const input = new Float32Array(n * 2);
|
|
3371
|
+
for (let i = 0; i < n; i++) {
|
|
3372
|
+
input[i * 2] = real[i];
|
|
3373
|
+
input[i * 2 + 1] = imag[i];
|
|
3374
|
+
}
|
|
3375
|
+
device.pushErrorScope("validation");
|
|
3376
|
+
scopePushed = true;
|
|
3377
|
+
bufA = pool.acquireStorageBuffer(bytes, "fft-a", true, true);
|
|
3378
|
+
bufB = pool.acquireStorageBuffer(bytes, "fft-b", true, true);
|
|
3379
|
+
staging = pool.acquireStagingBuffer(bytes, "fft-staging");
|
|
3380
|
+
device.queue.writeBuffer(bufA, 0, input);
|
|
3381
|
+
const pipeline = shaders.getRegisteredPipeline(SHADER_KEY);
|
|
3382
|
+
const encoder = device.createCommandEncoder({ label: "fft-stockham" });
|
|
3383
|
+
let src = bufA;
|
|
3384
|
+
let dst2 = bufB;
|
|
3385
|
+
for (let s = 0; s < stageUniforms.length; s++) {
|
|
3386
|
+
const bindGroup = device.createBindGroup({
|
|
3387
|
+
layout: pipeline.getBindGroupLayout(0),
|
|
3388
|
+
entries: [
|
|
3389
|
+
{ binding: 0, resource: { buffer: src } },
|
|
3390
|
+
{ binding: 1, resource: { buffer: dst2 } },
|
|
3391
|
+
{ binding: 2, resource: { buffer: stageUniforms[s] } }
|
|
3392
|
+
]
|
|
3393
|
+
});
|
|
3394
|
+
const pass = encoder.beginComputePass({ label: `fft-stage-${s}` });
|
|
3395
|
+
pass.setPipeline(pipeline);
|
|
3396
|
+
pass.setBindGroup(0, bindGroup);
|
|
3397
|
+
pass.dispatchWorkgroups(workgroups);
|
|
3398
|
+
pass.end();
|
|
3399
|
+
[src, dst2] = [dst2, src];
|
|
3400
|
+
}
|
|
3401
|
+
encoder.copyBufferToBuffer(src, 0, staging, 0, bytes);
|
|
3402
|
+
device.queue.submit([encoder.finish()]);
|
|
3403
|
+
const validationError = await device.popErrorScope();
|
|
3404
|
+
scopePopped = true;
|
|
3405
|
+
if (validationError) return null;
|
|
3406
|
+
await staging.mapAsync(GPUMapMode.READ, 0, bytes);
|
|
3407
|
+
const packed = new Float32Array(staging.getMappedRange(0, bytes).slice(0));
|
|
3408
|
+
staging.unmap();
|
|
3409
|
+
const outRe = new Float64Array(n);
|
|
3410
|
+
const outIm = new Float64Array(n);
|
|
3411
|
+
const scale = inverse ? 1 / n : 1;
|
|
3412
|
+
for (let i = 0; i < n; i++) {
|
|
3413
|
+
outRe[i] = packed[i * 2] * scale;
|
|
3414
|
+
outIm[i] = packed[i * 2 + 1] * scale;
|
|
3415
|
+
}
|
|
3416
|
+
return { real: outRe, imag: outIm };
|
|
3417
|
+
} catch {
|
|
3418
|
+
return null;
|
|
3419
|
+
} finally {
|
|
3420
|
+
if (res && scopePushed && !scopePopped) {
|
|
3421
|
+
try {
|
|
3422
|
+
await res.device.popErrorScope();
|
|
3423
|
+
} catch {
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
if (res) {
|
|
3427
|
+
if (bufA) res.pool.release(bufA);
|
|
3428
|
+
if (bufB) res.pool.release(bufB);
|
|
3429
|
+
if (staging) res.pool.release(staging);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3259
3434
|
// src/typed/signal.ts
|
|
3260
3435
|
import { computePool as computePool4 } from "@danielsimonjr/mathts-parallel";
|
|
3261
3436
|
|
|
@@ -3582,7 +3757,7 @@ function chirpZTransformDispatch(samples, m, phiStartRe, phiStartIm, phiStepRe,
|
|
|
3582
3757
|
|
|
3583
3758
|
// src/typed/signal.ts
|
|
3584
3759
|
var WASM_THRESHOLD = 64;
|
|
3585
|
-
function
|
|
3760
|
+
function isPowerOf22(n) {
|
|
3586
3761
|
return n > 0 && (n & n - 1) === 0;
|
|
3587
3762
|
}
|
|
3588
3763
|
function nextPowerOf2(n) {
|
|
@@ -3591,7 +3766,7 @@ function nextPowerOf2(n) {
|
|
|
3591
3766
|
}
|
|
3592
3767
|
async function fourStepFFT(real, imag, inverse) {
|
|
3593
3768
|
const N = real.length;
|
|
3594
|
-
if (N < 4 || !
|
|
3769
|
+
if (N < 4 || !isPowerOf22(N)) {
|
|
3595
3770
|
return fftCoreFloat64(real, imag, inverse);
|
|
3596
3771
|
}
|
|
3597
3772
|
const bits = Math.round(Math.log2(N));
|
|
@@ -3665,23 +3840,29 @@ var parallelFFT = mathTyped5("parallelFFT", {
|
|
|
3665
3840
|
const real = new Float64Array(paddedLength);
|
|
3666
3841
|
const imag = new Float64Array(paddedLength);
|
|
3667
3842
|
real.set(signal);
|
|
3668
|
-
const
|
|
3843
|
+
const gpu = await fftGpuDispatch(real, imag, false);
|
|
3844
|
+
if (gpu) return { real: gpu.real, imag: gpu.imag, originalLength: n };
|
|
3845
|
+
const result = computePool4.shouldParallelize(paddedLength, "parallelFFT") ? await fourStepFFT(real, imag, false) : fftCoreFloat64(real, imag, false);
|
|
3669
3846
|
return { ...result, originalLength: n };
|
|
3670
3847
|
}
|
|
3671
3848
|
});
|
|
3672
3849
|
var parallelIFFT = mathTyped5("parallelIFFT", {
|
|
3673
3850
|
// IFFT from real/imag arrays
|
|
3674
3851
|
"Float64Array, Float64Array": async (real, imag) => {
|
|
3675
|
-
|
|
3852
|
+
const gpu = await fftGpuDispatch(real, imag, true);
|
|
3853
|
+
if (gpu) return gpu;
|
|
3854
|
+
return computePool4.shouldParallelize(real.length, "parallelFFT") ? fourStepFFT(real, imag, true) : fftCoreFloat64(real, imag, true);
|
|
3676
3855
|
},
|
|
3677
3856
|
// IFFT from object with real/imag
|
|
3678
3857
|
Object: async (spectrum) => {
|
|
3679
|
-
|
|
3858
|
+
const gpu = await fftGpuDispatch(spectrum.real, spectrum.imag, true);
|
|
3859
|
+
if (gpu) return gpu;
|
|
3860
|
+
return computePool4.shouldParallelize(spectrum.real.length, "parallelFFT") ? fourStepFFT(spectrum.real, spectrum.imag, true) : fftCoreFloat64(spectrum.real, spectrum.imag, true);
|
|
3680
3861
|
}
|
|
3681
3862
|
});
|
|
3682
3863
|
var parallelFFTMagnitude = mathTyped5("parallelFFTMagnitude", {
|
|
3683
3864
|
"Float64Array, Float64Array": async (real, imag) => {
|
|
3684
|
-
if (computePool4.shouldParallelize(real.length)) {
|
|
3865
|
+
if (computePool4.shouldParallelize(real.length, "parallelFFT")) {
|
|
3685
3866
|
const r = await computePool4.applyKernel2(
|
|
3686
3867
|
real,
|
|
3687
3868
|
imag,
|
|
@@ -3701,7 +3882,7 @@ var parallelFFTMagnitude = mathTyped5("parallelFFTMagnitude", {
|
|
|
3701
3882
|
});
|
|
3702
3883
|
var parallelFFTPower = mathTyped5("parallelFFTPower", {
|
|
3703
3884
|
"Float64Array, Float64Array": async (real, imag) => {
|
|
3704
|
-
if (computePool4.shouldParallelize(real.length)) {
|
|
3885
|
+
if (computePool4.shouldParallelize(real.length, "parallelFFT")) {
|
|
3705
3886
|
const r = await computePool4.applyKernel2(real, imag, "(re, im) => re * re + im * im");
|
|
3706
3887
|
return r.result;
|
|
3707
3888
|
}
|
|
@@ -7348,12 +7529,13 @@ var typedSpecial = {
|
|
|
7348
7529
|
|
|
7349
7530
|
// src/gpu/elementwise-gpu.ts
|
|
7350
7531
|
import {
|
|
7351
|
-
getGpuDevice,
|
|
7352
|
-
getGlobalGPUContext,
|
|
7353
|
-
isGpuEnabled,
|
|
7532
|
+
getGpuDevice as getGpuDevice2,
|
|
7533
|
+
getGlobalGPUContext as getGlobalGPUContext2,
|
|
7534
|
+
isGpuEnabled as isGpuEnabled2,
|
|
7354
7535
|
GPU_MIN_ELEMENTS,
|
|
7355
|
-
ShaderManager,
|
|
7356
|
-
BufferPool
|
|
7536
|
+
ShaderManager as ShaderManager2,
|
|
7537
|
+
BufferPool as BufferPool2,
|
|
7538
|
+
serializeGpu as serializeGpu2
|
|
7357
7539
|
} from "@danielsimonjr/mathts-gpu";
|
|
7358
7540
|
var WGSL_IEEE = `
|
|
7359
7541
|
// NaN / \xB1Inf are supplied through the UNIFORM, not written as literals.
|
|
@@ -7426,7 +7608,7 @@ var GPU_ELEMENTWISE_OPS = Object.keys(
|
|
|
7426
7608
|
function isGpuChainSupported(ops) {
|
|
7427
7609
|
return ops.every((op) => op in WGSL_OP_BODY);
|
|
7428
7610
|
}
|
|
7429
|
-
var
|
|
7611
|
+
var WORKGROUP_SIZE2 = 256;
|
|
7430
7612
|
function wgslFor(op) {
|
|
7431
7613
|
return `
|
|
7432
7614
|
@group(0) @binding(0) var<storage, read> inp: array<f32>;
|
|
@@ -7439,7 +7621,7 @@ function wgslFor(op) {
|
|
|
7439
7621
|
${WGSL_OP_BODY[op]}
|
|
7440
7622
|
}
|
|
7441
7623
|
|
|
7442
|
-
@compute @workgroup_size(${
|
|
7624
|
+
@compute @workgroup_size(${WORKGROUP_SIZE2})
|
|
7443
7625
|
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
7444
7626
|
let i = gid.x;
|
|
7445
7627
|
if (i >= params.x) { return; }
|
|
@@ -7464,12 +7646,12 @@ function wgslForReduce(r) {
|
|
|
7464
7646
|
${WGSL_IEEE}
|
|
7465
7647
|
|
|
7466
7648
|
// NOTE: "shared" is a RESERVED WORD in WGSL \u2014 this must not be named that.
|
|
7467
|
-
var<workgroup> sdata: array<f32, ${
|
|
7649
|
+
var<workgroup> sdata: array<f32, ${WORKGROUP_SIZE2}>;
|
|
7468
7650
|
|
|
7469
7651
|
fn identity() -> f32 { return ${identity2}; }
|
|
7470
7652
|
fn combine(a: f32, b: f32) -> f32 { return ${combine2}; }
|
|
7471
7653
|
|
|
7472
|
-
@compute @workgroup_size(${
|
|
7654
|
+
@compute @workgroup_size(${WORKGROUP_SIZE2})
|
|
7473
7655
|
fn main(@builtin(global_invocation_id) gid: vec3<u32>,
|
|
7474
7656
|
@builtin(local_invocation_id) lid: vec3<u32>,
|
|
7475
7657
|
@builtin(workgroup_id) wid: vec3<u32>) {
|
|
@@ -7478,7 +7660,7 @@ function wgslForReduce(r) {
|
|
|
7478
7660
|
sdata[lid.x] = v;
|
|
7479
7661
|
workgroupBarrier();
|
|
7480
7662
|
|
|
7481
|
-
var s: u32 = ${
|
|
7663
|
+
var s: u32 = ${WORKGROUP_SIZE2}u / 2u;
|
|
7482
7664
|
loop {
|
|
7483
7665
|
if (s == 0u) { break; }
|
|
7484
7666
|
if (lid.x < s) { sdata[lid.x] = combine(sdata[lid.x], sdata[lid.x + s]); }
|
|
@@ -7489,13 +7671,13 @@ function wgslForReduce(r) {
|
|
|
7489
7671
|
}
|
|
7490
7672
|
`;
|
|
7491
7673
|
}
|
|
7492
|
-
var
|
|
7493
|
-
async function
|
|
7494
|
-
const device = await
|
|
7674
|
+
var resources2 = null;
|
|
7675
|
+
async function getResources2(options) {
|
|
7676
|
+
const device = await getGpuDevice2(options);
|
|
7495
7677
|
if (!device) return null;
|
|
7496
|
-
if (
|
|
7497
|
-
const ctx =
|
|
7498
|
-
const shaders = new
|
|
7678
|
+
if (resources2 && resources2.device === device) return resources2;
|
|
7679
|
+
const ctx = getGlobalGPUContext2();
|
|
7680
|
+
const shaders = new ShaderManager2(ctx);
|
|
7499
7681
|
for (const op of GPU_ELEMENTWISE_OPS) {
|
|
7500
7682
|
shaders.registerShader(op, wgslFor(op));
|
|
7501
7683
|
}
|
|
@@ -7503,31 +7685,25 @@ async function getResources(options) {
|
|
|
7503
7685
|
shaders.registerShader(reduceKey(r), wgslForReduce(r));
|
|
7504
7686
|
}
|
|
7505
7687
|
shaders.precompileRegistered();
|
|
7506
|
-
|
|
7507
|
-
return
|
|
7688
|
+
resources2 = { device, shaders, pool: new BufferPool2(ctx) };
|
|
7689
|
+
return resources2;
|
|
7508
7690
|
}
|
|
7509
7691
|
function resetGpuElementwise() {
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
}
|
|
7513
|
-
var gpuQueue = Promise.resolve();
|
|
7514
|
-
function serializeGpu(run) {
|
|
7515
|
-
const next = gpuQueue.then(run, run);
|
|
7516
|
-
gpuQueue = next.catch(() => void 0);
|
|
7517
|
-
return next;
|
|
7692
|
+
resources2?.pool.destroy();
|
|
7693
|
+
resources2 = null;
|
|
7518
7694
|
}
|
|
7519
7695
|
function elementwiseChainGpuDispatch(ops, xs, options) {
|
|
7520
|
-
return
|
|
7696
|
+
return serializeGpu2(() => chainGpuDispatchImpl(ops, xs, options));
|
|
7521
7697
|
}
|
|
7522
7698
|
async function chainGpuDispatchImpl(ops, xs, options) {
|
|
7523
7699
|
const n = xs.length;
|
|
7524
|
-
const enabled = options?.gpu ??
|
|
7700
|
+
const enabled = options?.gpu ?? isGpuEnabled2();
|
|
7525
7701
|
if (!enabled) return null;
|
|
7526
7702
|
if (ops.length === 0) return null;
|
|
7527
7703
|
if (n < GPU_MIN_ELEMENTS) return null;
|
|
7528
7704
|
if (!isGpuChainSupported(ops)) return null;
|
|
7529
7705
|
const bytes = n * 4;
|
|
7530
|
-
const workgroups = Math.ceil(n /
|
|
7706
|
+
const workgroups = Math.ceil(n / WORKGROUP_SIZE2);
|
|
7531
7707
|
let res;
|
|
7532
7708
|
let bufA;
|
|
7533
7709
|
let bufB;
|
|
@@ -7536,7 +7712,7 @@ async function chainGpuDispatchImpl(ops, xs, options) {
|
|
|
7536
7712
|
let scopePushed = false;
|
|
7537
7713
|
let scopePopped = false;
|
|
7538
7714
|
try {
|
|
7539
|
-
const r = await
|
|
7715
|
+
const r = await getResources2(options);
|
|
7540
7716
|
if (!r) return null;
|
|
7541
7717
|
res = r;
|
|
7542
7718
|
const { device, shaders, pool } = r;
|
|
@@ -7600,18 +7776,18 @@ async function chainGpuDispatchImpl(ops, xs, options) {
|
|
|
7600
7776
|
}
|
|
7601
7777
|
}
|
|
7602
7778
|
function elementwiseChainReduceGpuDispatch(ops, xs, reduce3, options) {
|
|
7603
|
-
return
|
|
7779
|
+
return serializeGpu2(() => chainReduceGpuDispatchImpl(ops, xs, reduce3, options));
|
|
7604
7780
|
}
|
|
7605
7781
|
async function chainReduceGpuDispatchImpl(ops, xs, reduce3, options) {
|
|
7606
7782
|
const n = xs.length;
|
|
7607
|
-
const enabled = options?.gpu ??
|
|
7783
|
+
const enabled = options?.gpu ?? isGpuEnabled2();
|
|
7608
7784
|
if (!enabled) return null;
|
|
7609
7785
|
if (ops.length === 0) return null;
|
|
7610
7786
|
if (n < GPU_MIN_ELEMENTS) return null;
|
|
7611
7787
|
if (!isGpuChainSupported(ops)) return null;
|
|
7612
7788
|
if (!GPU_REDUCE_OPS.includes(reduce3)) return null;
|
|
7613
7789
|
const bytes = n * 4;
|
|
7614
|
-
const workgroups = Math.ceil(n /
|
|
7790
|
+
const workgroups = Math.ceil(n / WORKGROUP_SIZE2);
|
|
7615
7791
|
const partialBytes = workgroups * 4;
|
|
7616
7792
|
let res;
|
|
7617
7793
|
let bufA;
|
|
@@ -7622,7 +7798,7 @@ async function chainReduceGpuDispatchImpl(ops, xs, reduce3, options) {
|
|
|
7622
7798
|
let scopePushed = false;
|
|
7623
7799
|
let scopePopped = false;
|
|
7624
7800
|
try {
|
|
7625
|
-
const r = await
|
|
7801
|
+
const r = await getResources2(options);
|
|
7626
7802
|
if (!r) return null;
|
|
7627
7803
|
res = r;
|
|
7628
7804
|
const { device, shaders, pool } = r;
|
|
@@ -16135,7 +16311,7 @@ async function gpuScale(a, scalar) {
|
|
|
16135
16311
|
}
|
|
16136
16312
|
|
|
16137
16313
|
// src/typed/index.ts
|
|
16138
|
-
import { enableGpu, disableGpu, isGpuEnabled as
|
|
16314
|
+
import { enableGpu, disableGpu, isGpuEnabled as isGpuEnabled3, GPU_MIN_ELEMENTS as GPU_MIN_ELEMENTS2 } from "@danielsimonjr/mathts-gpu";
|
|
16139
16315
|
|
|
16140
16316
|
// src/typed/relational.ts
|
|
16141
16317
|
import naturalSort from "javascript-natural-sort";
|
|
@@ -31758,7 +31934,7 @@ var createSplitUnit = /* @__PURE__ */ factory(
|
|
|
31758
31934
|
|
|
31759
31935
|
// src/matrix/fft.ts
|
|
31760
31936
|
var FAST_FFT_THRESHOLD = 64;
|
|
31761
|
-
function
|
|
31937
|
+
function isPowerOf23(n) {
|
|
31762
31938
|
return n > 0 && (n & n - 1) === 0;
|
|
31763
31939
|
}
|
|
31764
31940
|
function complexToInterleaved(arr7, _complex) {
|
|
@@ -31897,7 +32073,7 @@ var createFft = /* @__PURE__ */ factory(
|
|
|
31897
32073
|
function _fft(arr7, len) {
|
|
31898
32074
|
const length = len ?? arr7.length;
|
|
31899
32075
|
if (length === 1) return [arr7[0]];
|
|
31900
|
-
if (length === arr7.length && length >= FAST_FFT_THRESHOLD &&
|
|
32076
|
+
if (length === arr7.length && length >= FAST_FFT_THRESHOLD && isPowerOf23(length)) {
|
|
31901
32077
|
const interleaved = complexToInterleaved(arr7, complex2);
|
|
31902
32078
|
if (interleaved) {
|
|
31903
32079
|
const real = new Float64Array(length);
|
|
@@ -32205,7 +32381,7 @@ var createDivide = /* @__PURE__ */ factory(
|
|
|
32205
32381
|
|
|
32206
32382
|
// src/matrix/ifft.ts
|
|
32207
32383
|
var FAST_IFFT_THRESHOLD = 64;
|
|
32208
|
-
function
|
|
32384
|
+
function isPowerOf24(n) {
|
|
32209
32385
|
return n > 0 && (n & n - 1) === 0;
|
|
32210
32386
|
}
|
|
32211
32387
|
function complexToInterleaved2(arr7, _complex) {
|
|
@@ -32245,7 +32421,7 @@ var createIfft = /* @__PURE__ */ factory(
|
|
|
32245
32421
|
const totalSize = size2.reduce((acc, curr) => acc * curr, 1);
|
|
32246
32422
|
if (size2.length === 1) {
|
|
32247
32423
|
const length = size2[0];
|
|
32248
|
-
if (length >= FAST_IFFT_THRESHOLD &&
|
|
32424
|
+
if (length >= FAST_IFFT_THRESHOLD && isPowerOf24(length)) {
|
|
32249
32425
|
const arrData = isMatrix(arr7) ? arr7.valueOf() : arr7;
|
|
32250
32426
|
const interleaved = complexToInterleaved2(arrData, complex2);
|
|
32251
32427
|
if (interleaved) {
|
|
@@ -45464,6 +45640,7 @@ export {
|
|
|
45464
45640
|
fermiCoupling,
|
|
45465
45641
|
fft,
|
|
45466
45642
|
fft2d,
|
|
45643
|
+
fftGpuDispatch,
|
|
45467
45644
|
fibonacci,
|
|
45468
45645
|
filter2 as filter,
|
|
45469
45646
|
filtfilt,
|
|
@@ -45568,7 +45745,7 @@ export {
|
|
|
45568
45745
|
isConnected,
|
|
45569
45746
|
isFinite2 as isFinite,
|
|
45570
45747
|
isGpuChainSupported,
|
|
45571
|
-
|
|
45748
|
+
isGpuEnabled3 as isGpuEnabled,
|
|
45572
45749
|
isInteger2 as isInteger,
|
|
45573
45750
|
isNaN2 as isNaN,
|
|
45574
45751
|
isNegative,
|
|
@@ -45832,6 +46009,7 @@ export {
|
|
|
45832
46009
|
replacer,
|
|
45833
46010
|
resample,
|
|
45834
46011
|
resetGpuElementwise,
|
|
46012
|
+
resetGpuFft,
|
|
45835
46013
|
reshape2 as reshape,
|
|
45836
46014
|
residue,
|
|
45837
46015
|
resize2 as resize,
|
package/dist/typed/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export { cond } from './matrix-ops.js';
|
|
|
48
48
|
export * from './gpu.js';
|
|
49
49
|
export { enableGpu, disableGpu, isGpuEnabled, GPU_MIN_ELEMENTS } from '@danielsimonjr/mathts-gpu';
|
|
50
50
|
export { elementwiseChainGpuDispatch, elementwiseChainReduceGpuDispatch, GPU_REDUCE_OPS, type GpuReduceOp, isGpuChainSupported, resetGpuElementwise, GPU_ELEMENTWISE_OPS, type GpuElementwiseOp, type GpuChainOptions, } from '../gpu/elementwise-gpu.js';
|
|
51
|
+
export { fftGpuDispatch, resetGpuFft, type GpuFftOptions, type GpuFftResult, } from '../gpu/fft-gpu.js';
|
|
51
52
|
export * from './relational.js';
|
|
52
53
|
export { typedRelational } from './relational.js';
|
|
53
54
|
export * from './string.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,cAAc,aA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gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAsCtC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/typed/signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/typed/signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EACL,mBAAmB,EAOpB,MAAM,+BAA+B,CAAC;AAWvC,0CAA0C;AAC1C,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB,4BAA4B;AAC5B,KAAK,GAAG,GAAG,MAAM,CAAC;AAgJlB;;;;GAIG;AACH,eAAO,MAAM,WAAW,wCAiDtB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,YAAY,wCAqBvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,wCAwB/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,wCAoB3B,CAAC;AAMH;;;;GAIG;AACH,eAAO,MAAM,YAAY,wCAmEvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,wCAaxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,wCAQ3B,CAAC;AAMH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;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEtD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielsimonjr/mathts-functions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
|
|
5
5
|
"author": "Daniel Simon Jr.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@danielsimonjr/mathts-core": "^0.6.0",
|
|
38
38
|
"@danielsimonjr/mathts-expression": "^0.6.0",
|
|
39
|
-
"@danielsimonjr/mathts-gpu": "^0.
|
|
40
|
-
"@danielsimonjr/mathts-matrix": "^0.4.
|
|
39
|
+
"@danielsimonjr/mathts-gpu": "^0.2.0",
|
|
40
|
+
"@danielsimonjr/mathts-matrix": "^0.4.1",
|
|
41
41
|
"@danielsimonjr/mathts-parallel": "^0.3.4",
|
|
42
42
|
"bignumber.js": "^9.1.2",
|
|
43
43
|
"complex.js": "^2.2.5",
|