()
| 457 | |
| 458 | #[test] |
| 459 | fn go_with_map_spec() { |
| 460 | pyo3::prepare_freethreaded_python(); |
| 461 | Python::with_gil(|py| { |
| 462 | use crate::buffer::inner::{Buffer, DType}; |
| 463 | use crate::ir::compiler::ArgValue; |
| 464 | use crate::ir::expr::Expr; |
| 465 | use crate::ir::kernel::{ArgSpec, KernelKind, KernelSpec, TensorSpec}; |
| 466 | use crate::python::py_kernel::{PyKernelSpec, PyMapSpec}; |
| 467 | use std::collections::HashMap; |
| 468 | |
| 469 | let inner_spec = KernelSpec { |
| 470 | kind: KernelKind::Elementwise, |
| 471 | args: vec![ArgSpec { |
| 472 | name: "x".to_string(), |
| 473 | dtype: DType::F64, |
| 474 | is_scalar: false, |
| 475 | }], |
| 476 | output: TensorSpec { dtype: DType::F64 }, |
| 477 | expr: Expr::ArgRef(0), |
| 478 | }; |
| 479 | let spec = PyKernelSpec { inner: inner_spec }; |
| 480 | let mut args = HashMap::new(); |
| 481 | args.insert( |
| 482 | "x".to_string(), |
| 483 | ArgValue::Buffer(Buffer::from_f64_vec(vec![1.0, 2.0])), |
| 484 | ); |
| 485 | let map_spec = PyMapSpec { spec, args }; |
| 486 | let py_map = map_spec.into_pyobject(py).unwrap(); |
| 487 | |
| 488 | let runtime = PyRuntimeModule::new(); |
| 489 | let call_args = empty_args(py); |
| 490 | let task = runtime |
| 491 | .go(py, py_map.as_any(), &call_args, None, None) |
| 492 | .unwrap(); |
| 493 | assert!(task.inner.is_done()); |
| 494 | }); |
| 495 | } |
| 496 | |
| 497 | #[test] |
| 498 | fn go_with_reduce_spec() { |
nothing calls this directly
no test coverage detected