(&self, x: &Tensor, entry: &str)
| 856 | } |
| 857 | |
| 858 | fn dispatch_unary_vec4(&self, x: &Tensor, entry: &str) -> Result<Tensor> { |
| 859 | let dtype = x.dtype(); |
| 860 | let shape = x.shape().clone(); |
| 861 | let n = x.elem_count(); |
| 862 | |
| 863 | let buf_a = self.get_or_upload(x)?; |
| 864 | let buf_out = self.alloc_output(n); |
| 865 | |
| 866 | let threads_needed = (n as u32).div_ceil(4); |
| 867 | let result = self.dispatch_compute( |
| 868 | entry, |
| 869 | &[buf_a.buffer, self.dummy_buf.buffer, buf_out.buffer], |
| 870 | &buf_out, |
| 871 | n, |
| 872 | &[n as u32, 0, 0, 0], |
| 873 | (threads_needed.div_ceil(WG_ELEM), 1, 1), |
| 874 | ); |
| 875 | |
| 876 | let tensor = Self::from_f32_vec(result, shape.dims(), dtype)?; |
| 877 | self.cache_activation(tensor.id(), buf_out); |
| 878 | Ok(tensor) |
| 879 | } |
| 880 | |
| 881 | // ── GPU softmax ────────────────────────────────────────────────── |
| 882 |
no test coverage detected