-
Notifications
You must be signed in to change notification settings - Fork 655
Create stub files for the dynamic mode #6089
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
Conversation
Greptile OverviewGreptile SummaryThis PR extends DALI's stub file ( Key changes:
The implementation properly handles the complex type system for dynamic mode, including tensor/batch broadcasting semantics and proper type narrowing through overloads. Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Build as Build Process
participant StubGen as python_stub_generator.py
participant Sigs as _signatures.py
participant OpBuilder as _op_builder.py
participant Backend as DALI Backend
Build->>StubGen: Generate stubs for wheel
StubGen->>Sigs: gen_all_signatures(path, "fn")
StubGen->>Sigs: gen_all_signatures(path, "ops")
StubGen->>Sigs: gen_all_signatures(path, "dynamic")
Sigs->>Backend: _registry._all_registered_ops()
Backend-->>Sigs: List of schema names
loop For each operator schema
Sigs->>Backend: _b.TryGetSchema(schema_name)
Backend-->>Sigs: OpSchema
alt Dynamic API
Sigs->>Sigs: _gen_dynamic_signature(schema, name)
Sigs->>Sigs: _gen_dynamic_cls_signature() or _gen_dynamic_fun_signature()
Sigs->>Sigs: _gen_dynamic_call_signature(include_only_inputs=True)
Note over Sigs: __call__ gets tensor kwargs only
Sigs->>Sigs: _call_signature(include_kwarg_inputs=False)
Note over Sigs: __init__ gets non-tensor kwargs only
else Fn API
Sigs->>Sigs: _gen_fn_signature(schema, name)
Sigs->>Sigs: _call_signature(api="fn", include_inputs=True)
else Ops API
Sigs->>Sigs: _gen_ops_signature(schema, name)
Sigs->>Sigs: _call_signature(api="ops") for __init__ and __call__
end
Sigs->>Sigs: Write signature to .pyi file
end
alt Dynamic mode operators
OpBuilder->>OpBuilder: build_operator_class(schema)
OpBuilder->>OpBuilder: Set _generated = True
Note over OpBuilder: Runtime: __init__ skips tensor args,<br/>__call__ includes tensor args only
end
Sigs-->>StubGen: Stub files created
StubGen-->>Build: Stubs ready for packaging
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 1 comment
|
!build |
|
CI MESSAGE: [39065210]: BUILD STARTED |
|
CI MESSAGE: [39065210]: BUILD FAILED |
|
CI MESSAGE: [39065347]: BUILD STARTED |
|
CI MESSAGE: [39065347]: BUILD FAILED |
|
CI MESSAGE: [39070781]: BUILD STARTED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 1 comment
|
CI MESSAGE: [39070781]: BUILD FAILED |
|
CI MESSAGE: [39076892]: BUILD STARTED |
|
CI MESSAGE: [39076892]: BUILD FAILED |
|
CI MESSAGE: [39079519]: BUILD STARTED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 files reviewed, no comments
|
CI MESSAGE: [39079519]: BUILD FAILED |
|
!build |
…n definitions Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
The stubs generation script imports dali.exerimental.dynamic, which requires NVTX and makefun to be importable. Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
Signed-off-by: Rostan Tabet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9 files reviewed, no comments
|
!build |
|
CI MESSAGE: [39226828]: BUILD STARTED |
|
CI MESSAGE: [39226828]: BUILD PASSED |
Category: New feature (non-breaking change which adds functionality)
Description:
Currently stub (
*.pyi) files are only generated for "fn" and the legacy "ops" API. This PR adds stubs generation for dynamic mode.Additional information:
Affected modules and functionalities:
New
__init__.pyifiles get created during the build process.Key points relevant for the review:
Does the IDE / language server complain when using the API normally?
Does the IDE / language server properly report incorrect types?
Does the IDE properly suggest code completion?
You can use
typing.reveal_typeto see what type the type checker infers. For example:Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-4439