(&self, a: &Tensor, b: &Tensor, entry: &str)
| 801 | // ── Elementwise dispatch helpers ───────────────────────────────── |
| 802 | |
| 803 | fn dispatch_binary_vec4(&self, a: &Tensor, b: &Tensor, entry: &str) -> Result<Tensor> { |
| 804 | let dtype = a.dtype(); |
| 805 | let shape = a.shape().clone(); |
| 806 | let n = a.elem_count(); |
| 807 | |
| 808 | let buf_a = self.get_or_upload(a)?; |
| 809 | let buf_b = self.get_or_upload(b)?; |
| 810 | let buf_out = self.alloc_output(n); |
| 811 | |
| 812 | let threads_needed = (n as u32).div_ceil(4); |
| 813 | let result = self.dispatch_compute( |
| 814 | entry, |
| 815 | &[buf_a.buffer, buf_b.buffer, buf_out.buffer], |
| 816 | &buf_out, |
| 817 | n, |
| 818 | &[n as u32, 0, 0, 0], |
| 819 | (threads_needed.div_ceil(WG_ELEM), 1, 1), |
| 820 | ); |
| 821 | |
| 822 | let tensor = Self::from_f32_vec(result, shape.dims(), dtype)?; |
| 823 | self.cache_activation(tensor.id(), buf_out); |
| 824 | Ok(tensor) |
| 825 | } |
| 826 | |
| 827 | fn dispatch_ternary_vec4( |
| 828 | &self, |
no test coverage detected