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

Function float3DOutput

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

Source from the content-addressed store, hash-verified

167
168
169function float3DOutput(mode) {
170 const gpu = new GPU({ mode });
171 const cube = [
172 [
173 [1,2,3,4,5],
174 [6,7,8,9,10],
175 [11,12,13,14,15],
176 ],
177 [
178 [16,17,18,19,20],
179 [21,22,23,24,25],
180 [26,27,28,29,30],
181 ]
182 ];
183 const kernel = gpu.createKernel(function(cube) {
184 return cube[this.thread.z][this.thread.y][this.thread.x];
185 }, {
186 output: [5, 3, 2],
187 optimizeFloatMemory: true,
188 precision: 'single',
189 });
190 const result = kernel(cube);
191 assert.deepEqual(result.map(matrix => matrix.map(row => Array.from(row))), cube);
192 gpu.destroy();
193}
194
195(GPU.isSinglePrecisionSupported ? test : skip)('float 3d output auto', () => {
196 float3DOutput();

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…