MCPcopy Index your code
hub / github.com/gpujs/gpu.js / testSinglePrecisionArray

Function testSinglePrecisionArray

test/features/dynamic-arguments.js:993–1011  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

991});
992
993function testSinglePrecisionArray(mode) {
994 const gpu = new GPU({ mode });
995 const kernel = gpu.createKernel(function(input) {
996 return input[this.thread.x];
997 })
998 .setPrecision('single')
999 .setDynamicArguments(true)
1000 .setDynamicOutput(true)
1001 .setOutput([5]);
1002
1003 assert.deepEqual(kernel([1,2,3,4,5]), new Float32Array([1,2,3,4,5]));
1004 kernel.setOutput([4]);
1005 assert.deepEqual(kernel([1,2,3,4]), new Float32Array([1,2,3,4]));
1006 kernel.setOutput([3]);
1007 assert.deepEqual(kernel([1,2,3]), new Float32Array([1,2,3]));
1008 kernel.setOutput([2]);
1009 assert.deepEqual(kernel([1,2]), new Float32Array([1,2]));
1010 gpu.destroy();
1011}
1012
1013(GPU.isSinglePrecisionSupported ? test : skip)('single precision Array auto', () => {
1014 testSinglePrecisionArray();

Callers 1

Calls 7

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
setDynamicOutputMethod · 0.80
setDynamicArgumentsMethod · 0.80
setOutputMethod · 0.45
setPrecisionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…