erfc, cosh, and sinh are stubbed with raise NotImplementedError in
PyTorchSimFrontend/mlir/mlir_ops.py (cosh ~L465, sinh ~L469, erfc ~L526).
inductor lowers these as direct pointwise ops, not through a decomposition, so
they reach the handler and any graph containing one fails to compile.
repro:
import torch
def f(x):
return torch.erfc(x) # same for torch.cosh, torch.sinh
device = torch.device("npu:0")
x = torch.randn(128, 128).to(device=device)
torch.compile(dynamic=False)(f)(x)
# NotImplementedError from mlir_ops.erfc
these three don't need a new backend primitive. they compose from ops already in
the file (erf, exp, add, sub, mul, neg, constant), same shape as
the existing log10 / log1p / tan:
- erfc(x) = 1 - erf(x)
- cosh(x) = 0.5 * (exp(x) + exp(-x))
- sinh(x) = 0.5 * (exp(x) - exp(-x))
for tests i'd add test_erfc / test_cosh / test_sinh to
tests/test_transcendental.py, following test_erf / test_exp: compile on
npu:0, compare against cpu torch through the existing test_result helper
(rtol/atol 1e-4). that file already runs in CI, so the ops get covered.
the inverse-trig family (acos, asin, atan, asinh, acosh, atanh) is
stubbed the same way, but it can't be built from the existing primitives, so i
left it out here. can file that separately if it's useful.
i can put up a PR against develop with the three ops plus tests as one change,
validated in ghcr.io/psal-postech/torchsim-ci:v1.1.0. would you take it? happy
to change the approach if you'd rather handle these another way.
erfc,cosh, andsinhare stubbed withraise NotImplementedErrorinPyTorchSimFrontend/mlir/mlir_ops.py(cosh ~L465, sinh ~L469, erfc ~L526).inductor lowers these as direct pointwise ops, not through a decomposition, so
they reach the handler and any graph containing one fails to compile.
repro:
these three don't need a new backend primitive. they compose from ops already in
the file (
erf,exp,add,sub,mul,neg,constant), same shape asthe existing
log10/log1p/tan:for tests i'd add
test_erfc/test_cosh/test_sinhtotests/test_transcendental.py, followingtest_erf/test_exp: compile onnpu:0, compare against cpu torch through the existingtest_resulthelper(rtol/atol 1e-4). that file already runs in CI, so the ops get covered.
the inverse-trig family (
acos,asin,atan,asinh,acosh,atanh) isstubbed the same way, but it can't be built from the existing primitives, so i
left it out here. can file that separately if it's useful.
i can put up a PR against
developwith the three ops plus tests as one change,validated in
ghcr.io/psal-postech/torchsim-ci:v1.1.0. would you take it? happyto change the approach if you'd rather handle these another way.