Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [BUG] Half precision kernels not implemented for CPU #84

Closed
soodoshll opened this issue Feb 21, 2023 · 4 comments · Fixed by #85 or #89
Closed

🐛 [BUG] Half precision kernels not implemented for CPU #84

soodoshll opened this issue Feb 21, 2023 · 4 comments · Fixed by #85 or #89
Assignees
Labels
bug Something isn't working

Comments

@soodoshll
Copy link

Description

Hi!

When trying to run NNSmith on TorchJIT, I encountered errors like

ERROR   fuzz   - `make_testcase` failed with seed 1412986392. It can be NNSmith or Generator (torch) bug.
ERROR   fuzz   - Traceback (most recent call last):
  File "nnsmith/cli/fuzz.py", line 215, in run
    testcase = self.make_testcase(seed)
  File "nnsmith/cli/fuzz.py", line 187, in make_testcase
    model.refine_weights()  # either random generated or gradient-based.
  File "/home/su/accdiff/thirdparty/nnsmith/nnsmith/materialize/torch/__init__.py", line 40, in refine_weights
    _, inputs = searcher.search(
  File "/home/su/accdiff/thirdparty/nnsmith/nnsmith/materialize/torch/input_gen.py", line 56, in search
    res = self.search_one(cur_input, max_time_ms)
  File "/home/su/accdiff/thirdparty/nnsmith/nnsmith/materialize/torch/input_gen.py", line 110, in search_one
    return SamplingSearch.search_one(self, start_inp, timeout_ms)
  File "/home/su/accdiff/thirdparty/nnsmith/nnsmith/materialize/torch/input_gen.py", line 70, in search_one
    _ = self.net(**start_inp)
  File "/home/su/accdiff/thirdparty/pytorch/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/su/accdiff/thirdparty/nnsmith/nnsmith/materialize/torch/symbolnet.py", line 341, in forward
    output_tensors = inst(*input_tensors)
  File "/home/su/accdiff/thirdparty/pytorch/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/su/accdiff/thirdparty/nnsmith/nnsmith/materialize/torch/proxy_grad.py", line 108, in forward
    return PGReLUFunc.apply(x)
  File "/home/su/accdiff/thirdparty/pytorch/torch/autograd/function.py", line 506, in apply
    return super().apply(*args, **kwargs)  # type: ignore[misc]
  File "/home/su/accdiff/thirdparty/nnsmith/nnsmith/materialize/torch/proxy_grad.py", line 40, in forward
    return torch.relu(input)
RuntimeError: "clamp_min_scalar_cpu" not implemented for 'Half'

Installation

Source file without edits

Reproduction

yes | python nnsmith/cli/fuzz.py --config-dir nnsmith/config/ model.type=torch backend.type=torchjit fuzz.root=fuzz_report debug.viz=true backend.target=cuda

Screenshots

![DESCRIPTION](LINK.png)

Logs

No response

Front-end framework

No response

Version of the front-end framework

torch-2.0.0a0+git062380d

Back-end engine

torchjit

Version of the front-end engine

No response

Other context

No response

@soodoshll soodoshll added the bug Something isn't working label Feb 21, 2023
@ganler ganler self-assigned this Feb 21, 2023
@ganler
Copy link
Member

ganler commented Feb 21, 2023

@soodoshll Thanks for reporting this issue!

Could you kindly retry on latest main branch? Should be fixed by #85

@soodoshll
Copy link
Author

@ganler Thanks for your reply!

Unfortunately, I still can't run it with float16 on GPU. I'm wondering if model.refine_weights() should be executed on GPU since many half-precision operators are not supported on CPU.

@ganler
Copy link
Member

ganler commented Feb 21, 2023

You have a good point. My bad I did not well test the GPU part and will figure out how to enable that. Thanks for the input!

@ganler
Copy link
Member

ganler commented Mar 7, 2023

@soodoshll Apologies for the delay. We should be able to use backend.target=cuda now. Thanks for reporting and please let me know if there are any other issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants