(monkeypatch, benchmark_kernel, max_err)
| 131 | "benchmark_kernel, max_err", [(False, None), (True, 1e-5)], |
| 132 | ) |
| 133 | def test_matmul(monkeypatch, benchmark_kernel, max_err): |
| 134 | if get_device_count("gpu") == 0 and benchmark_kernel: |
| 135 | return |
| 136 | monkeypatch.setenv("MGE_FASTRUN_CACHE_TYPE", "MEMORY") |
| 137 | old1, old2 = ( |
| 138 | mge.config.benchmark_kernel, |
| 139 | mge.config.deterministic_kernel, |
| 140 | ) |
| 141 | mge.config.benchmark_kernel = benchmark_kernel |
| 142 | mge.config.deterministic_kernel = True |
| 143 | |
| 144 | @trace(symbolic=True, capture_as_const=True) |
| 145 | def fwd(data1, data2): |
| 146 | return F.matmul(data1, data2) |
| 147 | |
| 148 | data1 = Tensor(np.random.random((32, 64))) |
| 149 | data2 = Tensor(np.random.random((64, 16))) |
| 150 | result = fwd(data1, data2) |
| 151 | check_pygraph_dump(fwd, [data1, data2], [result], max_err=max_err) |
| 152 | mge.config.benchmark_kernel = old1 |
| 153 | mge.config.deterministic_kernel = old2 |
| 154 | monkeypatch.delenv("MGE_FASTRUN_CACHE_TYPE", raising=False) |
| 155 | |
| 156 | |
| 157 | def test_batchmatmul(): |
nothing calls this directly
no test coverage detected