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]: SPU codes can not normally jump and automatically expand function in VScode #858

Open
TY-cc opened this issue Sep 19, 2024 · 4 comments

Comments

@TY-cc
Copy link

TY-cc commented Sep 19, 2024

Issue Type

Support

Modules Involved

SPU runtime

Have you reproduced the bug with SPU HEAD?

Yes

Have you searched existing issues?

Yes

SPU Version

0.9.3

OS Platform and Distribution

linux ubuntu 22.04

Python Version

Python 3.10.4

Compiler Version

GCC 11.4

Current Behavior?

I am currently leanring SPU code in VScode. But it can not normally jump and automatically expand function in VScode. as the picture:
image
It point out
"xxxx" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue] (function) xxxx: Unknown
How to solve this problem?

Standalone code to reproduce the issue

This code is the jnp_debug.py [https://github.com/secretflow/spu/blob/main/spu/tests/jnp_debug.py](url)
import numpy as np

import spu.intrinsic as si
import spu.spu_pb2 as spu_pb2
import spu.utils.simulation as ppsim
im = ppsim.Simulator.simple(3, spu_pb2.ProtocolKind.CHEETAH, spu_pb2.FieldType.FM64)
copts = spu_pb2.CompilerOptions()
# Tweak compiler options
copts.disable_div_sqrt_rewrite = True

Relevant log output

`"ProtocolKind" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue]
(function) ProtocolKind: Unknown`

`"FieldType" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue]
(function) FieldType: Unknown`

`"CompilerOptions" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue]
(function) CompilerOptions: Unknown`
@anakinxc
Copy link
Contributor

These files are auto generated during build. For VSCode to find these files, build a wheel package and install in the python env.

@TY-cc
Copy link
Author

TY-cc commented Sep 25, 2024

Sorry, I don't know much about this. I haven't found any relevant guidance on historical issues and the Internet. Can you provide some guidance and help?

@tpppppub
Copy link
Member

see https://github.com/secretflow/spu/blob/main/libspu/spu.proto. Protobuf compiler will generate these files during building.

@TY-cc
Copy link
Author

TY-cc commented Sep 29, 2024

Thank for your reply,I had found this file.
But I can't understand how to use this file to solve the follow problems, Can you give me a sample?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants