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

Function float2DOutput

test/features/optimize-float-memory.js:125–142  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

123
124
125function float2DOutput(mode) {
126 const gpu = new GPU({ mode });
127 const matrix = [
128 [1,2,3,4,5],
129 [6,7,8,9,10],
130 [11,12,13,14,15],
131 ];
132 const kernel = gpu.createKernel(function(matrix) {
133 return matrix[this.thread.y][this.thread.x];
134 }, {
135 output: [5, 3],
136 optimizeFloatMemory: true,
137 precision: 'single',
138 });
139 const result = kernel(matrix);
140 assert.deepEqual(result.map(row => Array.from(row)), matrix);
141 gpu.destroy();
142}
143
144(GPU.isSinglePrecisionSupported ? test : skip)('float 2d output auto', () => {
145 float2DOutput();

Callers 1

Calls 3

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…