(rows, cols, inputBuffer, transpose = false)
| 565 | } |
| 566 | |
| 567 | newInstance(rows, cols, inputBuffer, transpose = false) { |
| 568 | const workgroupsX = cols > 4096 ? 256 : 64; |
| 569 | const fusedPipeline = this.getFusedPipeline(workgroupsX, transpose); |
| 570 | |
| 571 | const uniformBuffer = this.initUniform(4, [[0, new Uint32Array([rows, cols])]]); |
| 572 | const resultBuffer = this.initResultBuffer([rows, cols], `${this.name}_ResultBuffer_`); |
| 573 | const bindGroup = this.initBindGroup(this.u_s_Layout, [uniformBuffer, resultBuffer], `${this.name}_BindGroup_`); |
| 574 | const inputBindGroup = this.initBindGroup(this.r_Layout, [inputBuffer], `${this.name}_BindGroup__Input`); |
| 575 | const workgroups = { x: 1, y: wgSize(rows, 1), z: 1 }; |
| 576 | |
| 577 | return { |
| 578 | resultBuffer: resultBuffer, |
| 579 | passes: [ |
| 580 | { |
| 581 | flag: "compute", |
| 582 | pipeline: fusedPipeline, |
| 583 | groups: [bindGroup, inputBindGroup], |
| 584 | workgroups: workgroups, |
| 585 | }, |
| 586 | ], |
| 587 | }; |
| 588 | } |
| 589 | |
| 590 | /* |
| 591 | Possible improvements: Vectorization? Modify input buffer to coalesce better? |
nothing calls this directly
no test coverage detected